Click here to Skip to main content
Click here to Skip to main content

Execute SQL Query / SQL Command on SQL Server Using the Command Prompt

By , 3 Feb 2012
 
SQLCMD can be used to login to the Sql Server as well. One can only provide Server address, User Name and Password at the command prompt and press enter.
The command prompt will change to 1>. Now any sql query can typed and by pressing enter in the next prompt a GO command and pressing enter will execute the query and show the result on the screen.
 
This can be used when there is no SSMS available and just need to check any tables or execute any queries for maintenance.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

manish76235
Architect Safaltek Software
India India
Member
Working for over 20 years now and still learning.
Working for a product base company building solutions for the marine world.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Generalwe may have morethan one database, within that so many table... Pinmemberrajigopalan7 Feb '12 - 21:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 3 Feb 2012
Article Copyright 2012 by manish76235
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid