In SQLCMD and Powershell I wanted to take the list of databases. In MySQL “show databases” command was there. But in SQLCMD I was unable to find such a command.
SELECT Name FROM master.dbo.sysdatabases
You can use above commands in SSMS (if you are lazy to move your mouse to object explorer) and SQLCMD. Also you can use same thing on PowerShell too.
--Stored ProcedureBut in SQLPS you can go to your SQL Server instance’s database and just type “dir”.
Invoke-SQLCMD "EXEC sp_databases"
Invoke-SQLCMD "SELECT Name FROM master.dbo.sysdatabases"