Q. How do I connect to Microsoft SQL Server from command prompt? I just wanted to see list of tables and database.
A. MS- SQL Server is relational database management system.
Its primary query language is Transact-SQL, an implementation of the ANSI/ISO standard Structured Query Language (SQL) used by both Microsoft and Sybase.
There is command line tool available and it is called as sqlcmd. you need to enter the word GO after every command.
On the Start menu click Run. In the Open box type cmd, and then click OK to open a Command Prompt window.
At the command prompt, type sqlcmd.
Let us say your username is vivek and password is foo, use:
C:> sqlcmd -U vivek -P foo
Once connected you should see 1> prompt. Type following command to use database called sales:
To list tables type:
select * from SYSOBJECTS where TYPE = 'U' order by NAME
To List all the databases on the server:
To list fields in a table called foo:
- 30 Cool Open Source Software I Discovered in 2013
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop