Using OSQL in VS Command Prompt (2010)

  • Ok i was given this code below to run in the command prompt.

    osql -E -S .\SAM -i C:\aspnet.sql

    Can i just run the aspnet.sql in the window of SSMS 2008? I don't know what that code above means but i'm having problems running it.

  • What kind of problems are you having? Any error messages?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • At first it was telling me that osql didn't have good features. So just in case I thought I'd shorten the path and put the file in c:

    Here is the error message. Thanks!

    [SQL Server Native Client 10.0]SQL Server Network Interfaces: Error Locating

    Server/Instance Specified [xFFFFFFFF].

    [SQL Server Native Client 10.0]Login timeout expired

    [SQL Server Native Client 10.0]A network-related or instance-specific error

    has occurred while establishing a connection to SQL Server. Server is not

    found or not accessible. Check if instance name is correct and if SQL Server

    is configured to allow remote connections. For more information see SQL Server

    Books Online.

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>

  • Ok after going through all those steps, I went through all these steps found here. They were already set correctly which was good and encouraging. But that also met the problem was to be found else where.

    http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx

    This link below helped me to test my connections to the server and instance.

    http://blogs.msdn.com/b/spike/archive/2010/06/21/quot-error-locating-server-instance-specified-xffffffff-quot-sqlsrv32-to-the-rescue.aspx

    What i discovered was that the script i wrote earlier should have been

    osql -E -S SAM -i C:\aspnet.sql

    That is on my computer without the .\ or SAM\SAM

    Running osql -E -S SAM -i C:\aspnet.sql gave me the correct configuration.

    Thanks guys!!!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply