Home

Transact-SQL Kerwords: USE

   

Description

In Transact-SQL, the USE keyword is used to switch to a database.

To programmatically specify the current database, in a Query window or at the Command Prompt (including PowerShell), type the USE keyword followed by the name of the database. The formula to use is:

USE DatabaseName;

Here is an example:

USE GovernmentStatistics;

Here is another example that gives a user the right to create databases on the server:

USE master;
GO

GRANT CREATE ANY DATABASE
TO operez;
GO

To visually select a database and make it the current, in the SQL Designer toolbar, click the arrow of the Available Databases combo box and select the desired database:

Available Databases

     
 

Home Copyright © 2007-2011 FunctionX.com