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 declare does not work

Author  Topic 

arifliminto86
Starting Member

7 Posts

Posted - 2008-02-10 : 21:45:34
declare @fdas as varchar(10)
set @fdas = 'master'

use @fdas

i try to execute this one it does not work
said that Msg 102, Level 15, State 1, Line 4
Incorrect syntax near '@fdas'. how to fix that one? by not replacing the @fdas

but i got master database

------------

what is the difference actually between

use master than the first querry?



arifliminto86

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2008-02-10 : 21:55:47
You need to learn about Dynamic SQL.
Here is a start



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page
   

- Advertisement -