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

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 SQL COMMAND LINE - VARIABLE ALREADY DECLARED
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mruprai
Starting Member

9 Posts

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

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

webfred
Flowing Fount of Yak Knowledge

Germany
8765 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  
 New 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.17 seconds. Powered By: Snitz Forums 2000