SQL - How to backup SQL database and run query from command line

If you need to backup SQL database and you have not SQL Management Studio you can do that through command line:

SQLCMD -S SqlServerName\SqlInstanceName

BACKUP DATABASE VeeamBackup TO DISK = 'C:\BackupDB2016.06.09.bak'


If you need to run sql script you can proceed in this way:

SQLCMD -S SqlServerName\SqlInstanceName -i C:\temp\sqlscript.sql -o


SQL management Studion download you can review this veeam article where I copied and paste text: