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 2000 Forums
 SQL Server Development (2000)
 use database

Author  Topic 

pipi
Starting Member

18 Posts

Posted - 2005-06-14 : 04:26:20
i want to do this

Declare @CurDB varchar(128)
Set @curDB = DB_Name()
use @curdb
go


but, i have this error

Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near '@curdb'.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-14 : 04:35:15
Declare @CurDB varchar(128)
Set @curDB = DB_Name()
Exec('use '+@curdb)
go


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -