I get an error when I execute the command below from a DOS window in Windows XP with SQL Server 2008. -S is the option to specify the server name.
error: Sqlcmd: '-S': unknown option.
sqlcmd –S localhost –d databasename -i C:\files\somefile.sql –E
I get an error when I execute the command below from a DOS window in Windows XP with SQL Server 2008. -S is the option to specify the server name.
error: Sqlcmd: '-S': unknown option.
sqlcmd –S localhost –d databasename -i C:\files\somefile.sql –E
Is localhost the correct reference to use? Try sqlcmd -L to get the list of servers.
LocalHost
is for IIS
(LOCAL)
is for SQL Server. Or you can use a period
It's working now using '.' as the server name when I typed the line manually. What I did earlier was type the command in an editor, copied the ine and pasted into the command line. My guess is that an invisible control character got in there during the copy. I opened another dos window and typed a similar command using 'localhost' and it worked. I never used sqlcmd to connect to a server so I thought my syntax was wrong.
localhost, . & (local) should all work and if you use a non existent server name it will complain that it couldn't connect. It shouldn't say -S is not an option.