September 19, 2008 at 12:10 am
How to use sqlcmd utility with blank password. sa user having blank password. Following code gives error :=> Sqlcmd: '-P': Missing argument. Enter '-?' for help. I tried with console application in .net 2008
static void Main(string[] args)
{
string fileName = @"C:\Createtable.sql";
ProcessStartInfo info = new ProcessStartInfo("sqlcmd", @" -S DEV023\SQL2K -U sa -d pubs -o C:\sqlout.txt -i """ + @fileName + @""" -P");
info.UseShellExecute = false;
info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Hidden;
info.RedirectStandardOutput = true;
Process p = new Process();
p.StartInfo = info;
p.Start();
}
September 19, 2008 at 8:58 pm
sumit kende (9/19/2008)
How to use sqlcmd utility with blank password. sa user having blank password. Following code gives error :=> Sqlcmd: '-P': Missing argument. Enter '-?' for help. I tried with console application in .net 2008static void Main(string[] args)
{
string fileName = @"C:\Createtable.sql";
ProcessStartInfo info = new ProcessStartInfo("sqlcmd", @" -S DEV023\SQL2K -U sa -d pubs -o C:\sqlout.txt -i """ + @fileName + @""" -P");
info.UseShellExecute = false;
info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Hidden;
info.RedirectStandardOutput = true;
Process p = new Process();
p.StartInfo = info;
p.Start();
}
Only way to do it is with a "trusted connection". I don't have the precise syntax, but I'll just bet it's in Books Online.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply