Display Information

SHOW *RSQL only* displays the list of logins, databases, users, roles, tables, etc

Server Parameters

ALTER SERVER PARAMETER *RSQL only* alters the server parameters of the instance

Login Statements

A login and password form the credential used to establish a connection with the server.

CREATE LOGIN creates a new login
ALTER LOGIN alters login
DROP LOGIN drops login

Database Statements

CREATE DATABASE creates a new database
ALTER DATABASE alters database
DROP DATABASE drops database
ALTER AUTHORIZATION changes database owner

User and Role Statements

CREATE USER creates a new user
ALTER USER alters user
DROP USER drops user
CREATE ROLE creates a new role
ALTER ROLE alters role, adds or removes members
DROP ROLE drops role

Table Statements

CREATE TABLE creates a new table
ALTER TABLE alters table
DROP TABLE drops table
CREATE INDEX creates a new index on a table
ALTER INDEX alters index
DROP INDEX drops index
DECLARE @vartable TABLE creates a new fast temporary table

Permission Statements

GRANT creates permissions on the object
DENY creates DENY permissions on the object
REVOKE deletes permissions on the object

DML Statements

INSERT INTO inserts records into a table
SELECT retrieves records from tables
UPDATE updates records in a table
DELETE deletes records from a table
BULK INSERT inserts records into a table from a file
BULK EXPORT *RSQL only* exports records from a table into a file
TRUNCATE TABLE deletes all records from a table
SHRINK TABLE *RSQL only* physically shrinks the table and indexes files


BEGIN TRANSACTION starts an explicit transaction
COMMIT TRANSACTION marks the end of an explicit transaction
ROLLBACK TRANSACTION rollbacks an explicit transaction

SET options

SET QUOTED_IDENTIFIER allows identifiers delimited by double-quotes
SET ANSI_NULL_DFLT_ON specifies column nullability for CREATE TABLE
SET PARSEONLY parses and compiles the batch, but doesn't execute it
SET NOEXEC parses and compiles the batch, but doesn't execute it
SET NOCOUNT stops sending messages with affected rows count to the client


-- inline comment
/* ... */ block comment
USE changes the current database
SET LANGUAGE changes the current LANGUAGE setting
SET DATEFIRST changes the current DATEFIRST setting
SET DATEFORMAT changes the current DATEFORMAT setting
DECLARE @variable declares a new variable
SET @variable sets the variable to the specified value
PRINT sends the arguments to the client
SLEEP *RSQL only* sleeps for the specified number of seconds
THROW raises an error

Flow Control

BEGIN...END block of statements.
IF...ELSE conditional branch statement.
WHILE loop statement.
CONTINUE continues WHILE loop.
BREAK breaks out of WHILE loop.
GOTO jumps to label.
RETURN exits from the batch.


BACKUP creates a backup file of a database
RESTORE restores a database from a backup file


SHUTDOWN stops the server