0

All I would like to do is assign the name TestDatabase to the variable @test.

For some reason I can't seem to make it work. What is it that I could be missing here?

Here is my sample taken from the automatically generated script using visual studio.

 GO
 :setvar testdb "TestDatabase"

 --TSQL bit
 DECLARE @test nvarchar(10)
 set @test=$(testdb)  -- tried with $testdb, $[testdb]

Invalid column name 'testdb'. ** An error was encountered during execution of batch. Exiting.

1 Answer 1

2
 GO
 :setvar testdb "TestDatabase"

 --TSQL bit
 DECLARE @test nvarchar(10)
 set @test='$(testdb)'
Sign up to request clarification or add additional context in comments.

1 Comment

how come i forgot trying that bit?. Thank you very much @sidux. That was super quick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.