USE Statement in SQL SERVER

1.It is used to sets the current database.

2.Eg. USE databaseName

3.If we have not provided what database the tables in action queries like insert and select statements are from then the system will throw you an error.There are two options to resolve this problem either select the database from the drop down box from the SQL Server Management studio.The second option is to include a USE statement just before to your select or insert statement then the system will not throw any error and will use that database.

4.If you do not use the use statement whoever executes the script has to make sure that it is using correct database.

Pawan Kumar