Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Why is Alter Database @THISDB incorrect syntax?

Author  Topic 

DeepGround
Yak Posting Veteran

73 Posts

Posted - 2011-08-04 : 17:43:22
The syntax is correct until I put my variable in. Then it says it is incorrect near @THISDB.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-08-04 : 17:48:28
You have to use dynamic SQL for that.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

DeepGround
Yak Posting Veteran

73 Posts

Posted - 2011-08-04 : 18:06:50
Got it, I always seem to turn these simple 1 line statements into a book when working with SQL. :(
Go to Top of Page
   

- Advertisement -