|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 12:43 AM
Points: 378,
Visits: 897
|
|
I need a batch file script to read the hostname, and replace the hostname dynamicaly where we see 'Hostname' in below script.
sqlcmd -S Hotsname\Inst -i C:\abc.sql
can some one provide this.
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 8:27 AM
Points: 11,605,
Visits: 27,646
|
|
in a bat/cmd file or command prompt, you can get the computer name from the variable %computername%
echo %computername% so you can build a script with that...does that help?
edit
also, if the script is alwasy being run on the same server, you don't need the computername anyway...you can just use the dot placeholder to reference the current server, i think
sqlcmd -S .\Inst -i C:\abc.sql
Lowell
--There is no spoon, and there's no default ORDER BY in sql server either. Actually, Common Sense is so rare, it should be considered a Superpower. --my son
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 12:43 AM
Points: 378,
Visits: 897
|
|
|
|
|