0

Can anyone decipher this error message? Somebody gave me a SQL script and when I run it, I get this error:

http://i890.photobucket.com/albums/ac103/mmh924/image001.png

Thanks.

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
Skizz
  • 1,211
  • 5
  • 17
  • 28
  • Could you post the script? It sounds like you might be having issues with quotes, but we'd have to see it. – Brian Hoover Aug 03 '11 at 17:19
  • 1
    I hope that you removed the password for purposes of the screen shot, and that you aren't really using sa/blank. On a local machine protected by other means it probably isn't a big deal, but it's not a very good practice. – Aaron Bertrand Aug 03 '11 at 17:22
  • It's a local machine. I'm investigating now. Thanks for all the replies. – Skizz Aug 03 '11 at 17:33
  • 2
    For SQL Server 2005 and newer, you should stop using `osql` and instead use the new `sqlcmd` tool instead. – marc_s Aug 03 '11 at 19:15

4 Answers4

1

If it is an instance of SQL Server Express, it is likely a named instance. So try adding -S .\SQLEXPRESS to the command.

Also see this blog post for common troubleshooting ideas: http://blogs.msdn.com/b/sql_protocols/archive/2007/03/31/named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server.aspx

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
0

Sounds like you might not have remote connections enabled on the SQL Server you are trying to run this script against. Take a look at this article:

http://support.microsoft.com/kb/914277

Abe Miessler
  • 82,532
  • 99
  • 305
  • 486
0

You do not have the Server name parameter specified in there.

`osql -U sa iP -i dbattach05.sql`

You might want this

`osql -S ServerOrInstanceNameGoesHere -U sa iP -i dbattach05.sql`
Raj More
  • 47,048
  • 33
  • 131
  • 198
0

You might need to do something like this if its an Express edition: http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/

MAW74656
  • 3,449
  • 21
  • 71
  • 118