![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
DECLARE c_Scripts cursor FAST_FORWARD for SELECT ScriptName from @TestTable OPEN c_Scripts FETCH NEXT FROM c_Scripts INTO @ScriptName WHILE @@FETCH_STATUS = 0 Begin Select @ScriptName = quotename(@ScriptName,'"') Print @ScriptName :setvar SetVariablesScript @ScriptName :r $(SetVariablesScript) FETCH NEXT From c_Scripts INTO @ScriptName End CLOSE c_Scripts DEALLOCATE c_Scripts Doesn't work! A While loop doesn't work either. |
|
I could do this in a windows for loop but if one sql file fails I would like NOT to execute any others. for %%X in (*.SQL) do SQLCMD -S ServerName -d DatabasesName -U UserName -P UserPassword -I -i "%%X" >> ResultScript.txt |
|
There must be someway to iterate through a list and execute the .sql file. While Perl is an option to me I would rather keep this out of Perl. |
![]() |
| Thread Tools | |
| Display Modes | |
| |