Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

12 Posts

Posted - 08/21/2014 :  07:26:39  Show Profile  Reply with Quote

im using SQL cmd line to run multiple scripts at once.

one issue I get is that I get the error 'variables are already declared.

the script I run is as follows

:r $(InstallPath)$(PrepScriptDIR)ImportScript_EDIT.sql

:r $(InstallPath)$(PrepScriptDIR)ImportTestsUpdate.sql

is there anyway to kind of put something in between these too scripts to clear all variables?

kind regards

Flowing Fount of Yak Knowledge

8781 Posts

Posted - 08/21/2014 :  08:28:51  Show Profile  Visit webfred's Homepage  Reply with Quote
There is no way to "undeclare".
:r tells me you are using the possibility to call scripts in scripts.
So the clean way could be to declare the variables only once in an early script.

Another way, don't know if it works, but you can try: insert a new scriptfile between them with the one and only statement GO to clear all...

Too old to Rock'n'Roll too young to die.

Edited by - webfred on 08/21/2014 08:31:33
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000