October 24, 2012 at 9:18 am
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.
October 24, 2012 at 9:21 am
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
October 25, 2012 at 1:44 am
Thanks..
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply