April 18, 2008 at 3:39 pm
This code works:
:setvar sourceDB 'master'
select $(sourcedb)
This code does not:
:setvar sourceDB 'master'
use $(sourcedb)
Any ideas why???
Thank you for you time! 🙂
April 18, 2008 at 4:10 pm
Where is the Microsoft SQL Server 2005 related problem?
N 56°04'39.16"
E 12°55'05.25"
April 18, 2008 at 4:19 pm
Peso (4/18/2008)
Where is the Microsoft SQL Server 2005 related problem?
I am trying to execute this in SQL Server 2005. I can use the variable in some ways ... but, not another. When I use the variable with a select statement - it works fine. But, when I try to use it to set the database (use ) it fails.
I was hoping someone could help me out.
The command that is failing is even in BOL under sqlcmd ... I'm not sure what I am doing wrong.
Thanks,
Jen
April 18, 2008 at 4:21 pm
I mean, what client language is that?
And where is it executed?
N 56°04'39.16"
E 12°55'05.25"
April 18, 2008 at 4:34 pm
Peso (4/18/2008)
I mean, what client language is that?And where is it executed?
I am running it from within Management Studio ... after turning on SQLCMD Mode.
SQLCMD is a command line utility in sql server 2005 which is taking the place of OSQL and ISQL.
April 18, 2008 at 11:41 pm
it should work if you remove the single quotes around master:
:setvar sourceDB master
use $(sourcedb)
---------------------------------------
elsasoft.org
April 20, 2008 at 7:42 am
Well, that would explain it. I just didn't see that. Thanks! 🙂
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply