p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning Microsoft SQL Server 2012 Programming (http://p2p.wrox.com/forumdisplay.php?f=681)
-   -   SQLCMD, pg 405/406 (http://p2p.wrox.com/showthread.php?t=89931)

sidejack April 26th, 2013 12:58 PM

SQLCMD, pg 405/406
 
Ok gang, looking at page 405/406 of the book (i.e. SQLCMD)
Tried the code on page 406 (since I'm using Windows authentication, blank password) and I get:

"Sqlcmd: Error: Microsoft SQL Server Native Client 11.0: Named Pipes Provider: Could not open a connection to SQL Server [2].."

along with Login timeout expired & A network-related or i....

Tried it will my user name and/or password anyway, same results

Ideas?.....sidejack

sidejack April 29th, 2013 04:36 PM

Solved!
 
I can't take all the credit; I have a student smarter than I.

To run SQLCMD in the command line, one first needs to connect to the server, which in the example below is ORACLE-PC\SQLEXPRESS (case sensitive)

C:\SQLCMD -S ORACLE-PC\SQLEXPRESS <ENTER>
1>

At the 1> prompt, connect to the database (example uses Master) followed by GO

1>USE Master
2>GO
Changed database to 'Master'.
1>

Now one is ready to enter SELECT statements (use GO to execute)


All times are GMT -4. The time now is 07:07 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.