Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2006
    Location
    MA
    Posts
    3

    Question Unanswered: Connect to SQL Server 2005 using command line

    Hi all,

    I have used Oracle's sqlplus command line tool in the past and am familiar with it. I would like to learn MS SQL Server's command line tool of isql. When I try to connect I get the error below. I've studied up and it appears my server is not in my interfaces file, but I do not know much about SQL Server. Can someone please assist me or point me in the right direction?


    CT-LIBRARY error:
    ct_connect(): directory service layer: internal directory control layer error: Requested server name not found.

  2. #2
    Join Date
    Dec 2002
    Posts
    1,245
    Quote Originally Posted by Annorax
    Hi all,

    I have used Oracle's sqlplus command line tool in the past and am familiar with it. I would like to learn MS SQL Server's command line tool of isql. When I try to connect I get the error below. I've studied up and it appears my server is not in my interfaces file, but I do not know much about SQL Server. Can someone please assist me or point me in the right direction?


    CT-LIBRARY error:
    ct_connect(): directory service layer: internal directory control layer error: Requested server name not found.
    With SQL Server 2005, use osql.

    c:> osql -S <your server name> -E

    Notes:
    1. This will give you access to SQL Server <your server name> using Windows integrated authentication.
    2. The switches in osql are case sensitive.

    Regards,

    hmscott
    Last edited by hmscott; 06-15-09 at 17:39.
    Have you hugged your backup today?

  3. #3
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    actually osql is deprecated in 2005. sqlcmd.exe is what you want.

  4. #4
    Join Date
    Dec 2002
    Posts
    1,245
    Quote Originally Posted by jezemine
    actually osql is deprecated in 2005. sqlcmd.exe is what you want.
    Jezemine is absolutely right. I rarely use command line and I think osql came out by muscle memory more than anything else.

    sqlcmd -S <your server name> -E

    Connects you to a sql 2005 (or SQL 2000) instance using windows integrated authentication.

    Regards,

    hmscott
    Have you hugged your backup today?

  5. #5
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    Quote Originally Posted by hmscott
    Jezemine is absolutely right. I rarely use command line and I think osql came out by muscle memory more than anything else.

    sqlcmd -S <your server name> -E

    Connects you to a sql 2005 (or SQL 2000) instance using windows integrated authentication.

    Regards,

    hmscott

    I use the command line quite a bit for cmd scripting. isql anyone ?

  6. #6
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I agree, isql.exe was a great tool for SQL 7.

    I used osql.exe in SQL 2000, and have used sqlcmd.exe in SQL 2005 and SQL 2008.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •