Tuesday, November 24, 2009

How to Execute SQL Queries thru SQLCMD


You can execute the all kind of SQL Expression thru command prompt. Here I explained simple example
1. Open Command Prompt
2. Enter SQLCMD –S "SQL SERVER INSTANCE NAME" -D "DATABASE NAME"
3. once you enter above line, it will connect to the database by using windows authentication
4. then write a query, press enter



5. terminate the query with GO statement, press Enter
6. It will display the records as shown below.


To Terminate from SQL,  Type Exit, then press Enter

No comments:

Post a Comment

Post a Comment