15
Incorrect syntax near '%.*s'.
This error occurs when Adaptive Server detects a syntax error in a Transact-SQL® command or query. This error can occur when:
A keyword is misspelled.
A keyword or parameter is missing.
The order of keywords is incorrect.
You use an editor invoked from isql to write a SQL command or batch, end your SQL with “go” or another terminator, then run the file from isql. This causes an error only in some cases.
A script that used to work no longer works after you changed the sort order or the character set of an Adaptive Server (for example, a script created on a server that originally was not case-sensitive and now Adaptive Server’s sort order has been changed to case-sensitive).
A reserved word has been used in a query (for example, select user = suser_name() raises error 102 because “user” is a reserved word).
You used a variable instead of a specific period of time following a waitfor delay statement. Variables are not supported in this case. For example, the following input would raise error 102:
1> declare @t char(9) 2> select @t = "00:00:01" 3> waitfor delay @t 4> go
You used a variable for a database name and your query contains a parser error; error 102 is raised because the batch was never executed. Steps for executing a query are:
Read the batch
Parse the batch
Optimize the batch
Execute the batch
Any step that fails stops the query from processing.
Check the spelling and syntax of the command specified in the error message. If it is wrong, correct it in your Transact-SQL statement and run it again.
You can invoke an editor such as vi from isql to edit a SQL statement or statements. However, for the statements to execute, you have to enter the command termination string (usually “go”) after you return to isql. If you include the command termination string in the editor, then save the file and return to isql, the statement will not execute. If you enter the command termination string again after returning to isql, you receive the following error (vi is the editor in this example; you may be using a different editor):
1> vi
1> select * from sysmessages where error = 102 2> go 3> go
Msg 102, Level 15, State 1: Server 'REL1002_NAME', Line 2: Incorrect syntax near 'go'.
If you are not sure whether a query contains a reserved word, use this query to see a complete list of reserved words:
1> select name from spt_values where type = "W" 2> go
Refer to the most current version of the Utility Guide, Transact-SQL User’s Guide, or the Adaptive Server Enterprise reference manuals for correct syntax.
All versions