Earlier I have written beginners guide on MS-SQL server. In this post i’ll cover few more things about ms-sql server which are intended towards beginners. If you are beginner then I suggest you to read this post first.
How to add comments in sql-server script?
You can use “- -“to add comments to the sql server. You’ll see the comments in light green/gray shades depending upon the preferences.
How to create database?
Type the following syntax to create database:
How to get list of all databases?
To get the list of all databases type the following syntax:
Select * from Sys.databases;
How to use databases?
If you want to use the database you’ve just created, type the following command:
How to backup database?
You can backup database by using following command:
backup database to disk =’path/.mdf’;
How to restore the database?
If you want to restore the backed up database then use the following command:
restore database from disk=”path/.mdf
These are some of the basic commands that newbies need in order to quickly start working with the Microsoft’s SQL server. If you’ve any questions or suggestion, corrections then feel free to let me know here.