Connect to Database Using CMD


Sometimes it serves a lot of time to just connect to the database using the command prompt, its easy, reliable and fast.
In this section, I will outline how to connect to an instance of SQL server and get access to databases on your local machine:
  1. Open up a command prompt
  2. type: sqlcmd
  3. On the same line, type: -S(ServerName\SqlInstanceName)
  4. Then you can query: Select * from sys.databases
  5. On the next line: Type Go
  6. If successfully connected, all the databases will display
  7. Then go ahead and choose which database to use by typing:
  8. Use "your database"
  9. On the next line:
  10. If you are using T-sql just to show the tables in that database just type:
  11. sp_tables "DatabaseName" (without quotation marks)
  12. On the next line, type 'Go' and enter
  13. All the tables should display then use the tables you want to query the data. Have fun.

Databases
published
v.0.01




For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email AddressContact: [email protected]