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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 USE command in sql server

Author  Topic 

lipkee85
Starting Member

7 Posts

Posted - 2010-07-12 : 21:53:34
Hi all,

I have this error when I use a variable beside USE. Is there any other way of writing this?

DECLARE @targetDatabase varchar(20)

SET @targetDatabase = 'Testing'

USE @targetDatabase
--process logic



khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-07-12 : 22:37:04
USE does not support a variable



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

lipkee85
Starting Member

7 Posts

Posted - 2010-07-12 : 23:00:19
thx :)
Go to Top of Page
   

- Advertisement -