04/18/2007 11:34:31
(37000/102), [Microsoft][SQL Native Client][SQL Server]Incorrect syntax near '\'.
DECLARE @.curdate DATETIME
SET @.curdate = GETDATE()
Insert into OPTION (ID, NUM, VAR, VALUE, DATE_MODIFIED, USER_MODIFIED, READ_ONLY)
SELECT distinct ID, NUM, 'stack', 'S', @.curdate, 'ADMIN', '1'
FROM OPTION
WHERE VAR='option' and FLOOR(FL_VALUE\POWER(2,3))%2=1
The piece of code above works in a sql server management studio query window but does not work through ODBC. Can someone help me in the syntax for this \
It seems to recognize / but not \
Thanks
Maybe change this line:
WHERE VAR='option' and FLOOR(FL_VALUE\POWER(2,3))%2=1
to this:
WHERE VAR='option' and FLOOR(FL_VALUE/POWER(2,3))%2=1
I guess the short answer to your question is that '/' and '\' are not recognized as the same operator.
|||I apologize I had it backwards. The line is setup up like you change
WHERE VAR='option' and FLOOR(FL_VALUE/POWER(2,3))%2=1;
The error completely ignores is: Ive tried to use different symbols such as \/ or //
Nothing seems to work
|||Please explain what you are attempting to do...
What is not working?
|||It works when run directly from management studio. Im trying to insert a new record into the same table based on whether the 3rd bit is set in the VALUE column. The syntax is correct. However, when I run this through ODBC the error is:
VALUEPOWER is not a recognized built-in function name.
Somehow ODBC is ignoring the /
There has to be some way to make it understand
|||It is not ODBC, it is the programming language you are using. What did you write the code in? Post your actual code.|||Also, why not to use much more simple way:
WHERE VAR='option' and FL_VALUE & POWER(2,3) > 0
The only restriction I remember is that FL_Value has to be of integer type (tinyint, smallint, or int). Anyway, you can always use cast() if need be...
|||
Buddy give the complete code & language which you are using...
If you provide which ODBC/provider component using on your code should make sense..
I am really surprised how WHERE VAR='option' and FL_VALUE & POWER(2,3) > 0 will replace the WHERE VAR='option' and FLOOR(FL_VALUE/POWER(2,3))%2=1
|||Author says "whether the 3rd bit is set" - my code is doing just the same, but in a more straight manner.
Also, I doubt it's the problem in the ODBC driver or provider or whatever. Instead, I prefer to look into the client code where this query is constructed - the error may reside there, as well...
No comments:
Post a Comment