cancel
Showing results for 
Search instead for 
Did you mean: 

hello friends..i m not able to connect MS SQL SERVER 2005 FROM cmd prompt

Former Member
0 Kudos

dear friends,

i m not able to connect MS SQL SERVER from command prompt..

do you know how to connect from command prompt or any other ways to connect to database only for delete SAP* user purpose.

thanks

zaheer

Accepted Solutions (0)

Answers (3)

Answers (3)

clas_hortien
Employee
Employee
0 Kudos

Hi,

you can use the SQLCMD tool:

Microsoft (R) SQL Server Command Line Tool

Version 10.50.1600.1 NT x64

Copyright (c) Microsoft Corporation. All rights reserved.

usage: Sqlcmd [-U login id] [-P password]

[-S server] [-H hostname] [-E trusted connection]

[-N Encrypt Connection][-C Trust Server Certificate]

[-d use database name] [-l login timeout] [-t query timeout]

[-h headers] [-s colseparator] [-w screen width]

[-a packetsize] [-e echo input] [-I Enable Quoted Identifiers]

[-c cmdend] [-L[c] list servers[clean output]]

[-q "cmdline query"] [-Q "cmdline query" and exit]

[-m errorlevel] [-V severitylevel] [-W remove trailing spaces]

[-u unicode output] [-r[0|1] msgs to stderr]

[-i inputfile] [-o outputfile] [-z new password]

[-f <codepage> | i:<codepage>[,o:<codepage>]] [-Z new password and exit]

[-k[1|2] remove[replace] control characters]

[-y variable length type display width]

[-Y fixed length type display width]

[-p[1] print statistics[colon format]]

[-R use client regional setting]

[-b On error batch abort]

[-v var = "value"...] [-A dedicated admin connection]

[-X[1] disable commands, startup script, enviroment variables [and exit]]

[-x disable variable substitution]

[-? show syntax summary]

You have to have the SQL Server tools installed on the box, to get sqlcmd.

You then can connect with SQL authentication

sqlcmd -S <Servername\Instancename> -U user -P password

or with windows authentication

sqlcmd -S <Servername\Instancename> -E

Best regards

Clas

Former Member
0 Kudos

You can always start SQL Server Management Studio and go into Query Analyzer (click on New Query button). Type in your queries as described above. There also is a command parse function to check your syntax before execution.

Regards,

Alan

Former Member
0 Kudos

How are you trying to connect to SQL server (what commands are you using?

Here's are some references to start with:

http://www.cyberciti.biz/faq/howto-ms-sql-list-tables-and-database/

Thanks!

J. Haynes

Former Member
0 Kudos

hi Joe,

thanks

...

i just know command : sqlplus "/ as sysdba"

and i think it's useful for oracle .. so i tried i m not getting connection.

so do you know how to connect to sm sql server only delete SAP* USER.

shall i go with given link.

thanks

zaheer

Former Member
0 Kudos

Dear Zaheer,

Befor posting always try to search for solution.

check out this link [|]

Regards,

Nikunj Thaker

former_member184473
Active Contributor
0 Kudos

Hello Zaheer,

Just to complement Nikunj 's reply, sqlplus is the Oracle tool to connect to the database. For SQL Server you can use the sqlcmd.

Regards,

Eduardo Rezende