This error is received when changing database using "use" command on sqlcmd window. I have verified that database name is exists and there is no spell mistake but still error is received. Doing google search nothing getting from articles. After relaxation of some time i have noticed the error carefully it is saying syntax error near '2019'
That mean something fishy in database name itself.
1> use 2019_database
2> go
Msg 102, Level 15, State 1, Server *********, Line 1
Incorrect syntax near '2019'.
1> use [2019_database]
2> go
Changed database context to '2019_database'.
1>
Solution:
use solid bracket around the database backup name
Do/Donts
That mean something fishy in database name itself.
1> use 2019_database
2> go
Msg 102, Level 15, State 1, Server *********, Line 1
Incorrect syntax near '2019'.
1> use [2019_database]
2> go
Changed database context to '2019_database'.
1>
Solution:
use solid bracket around the database backup name
Do/Donts
- Best practice to keep database name starting from alphabet a-z
- If Database name start from Numeric then donot forget to use solid brackets around the database name
- Always use "GO" on sqlcmd to execute query
No comments:
Post a Comment