sqlcmd -s <db server or instance> -q "exec sp_databases"
Examples:
sqlcmd -s localhost -q "exec sp_databases"
sqlcmd -s dbserver -u loginname -p password -q "exec sp_databases"
sqlcmd -s ./MSSQLSERVER -u loginname -p password -q "exec sp_databases"
Wednesday, 29 June 2011
Deleting a database with sqlcmd
sqlcmd -s <servername> -q "DROP DATABASE <database name>"
OR
sqlcmd -s ./<sqlserver instance name> -q "DROP DATABASE <database name>"
Examples:
OR
sqlcmd -s ./<sqlserver instance name> -q "DROP DATABASE <database name>"
Examples:
sqlcmd -s dbserver -u username -p password -q "DROP DATABASE products"
sqlcmd -s localhost -q "DROP DATABASE products"
sqlcmd -s ./MSSQLSERVER -q "DROP DATABASE products"
Subscribe to:
Posts (Atom)