Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Tuesday 4 August 2015

SQLCMD In SQL



The most important option that you need to know about SQLCMD are as follows:-

Note:- SQLCMD options are case-sensitive.

·       -S <sql_server_name>:-  the name of the SQL Server, including instance, if applicable. You may use "." (without quotes) if you are running SQLCMD on the same machine as SQL Server.
·       -d <database_name>:-  the name of the database on which the operation is to be performed. For example -d Test.
·       -U <user_name>:-  the SQL Server user account under which to run the specified command.
·       -P <password>:- the password associated with the specified user account.
·       -E :- use NT authentication to interact with SQL Server
·       -Q "<SQL-command>":- the command to issue to SQL Server.
·       -i <file_of_SQL_commands>:-  a file containing one or more commands to issue to SQL Server.
SQLCMD can also operate interactively. If you specify only the server, database, user name, and password, you will be presented with a prompt allowing you to enter and execute commands one at a time. The command "exit" exists interactive mode.

For more information about other options, you can type "SQLCMD -?" for help.
Please provide your feedback in the comments section above. Please don't forget to follow.