Chapter 14 Flashcards
What’s the name of the system database that stores temporary tables?
tempdb
A series of SQL statements that you can store in a file is called a
script
Which statement can you use to handle errors caused by one or more SQL statements?
TRY…CATCH
What do you call a local variable that can store a single value?
scalar
Which utility can you use to execute Transact-SQL scripts from a command line?
SQLCMD
Which statement changes the database context to a database named TestDB?
USE TestDB;
Which statement do you use to return a message to the client?
Which system function can you use to return the value of the most recently assigned identity column?
@@IDENTITY
What statement can you use to divide a script into multiple batches?
GO
Which statement assigns the value “Test” to a scalar variable named @Name that’s declared with the varchar data type?
SET @Name = ‘Test’;
Which statement can you use to control the flow of execution based on a true/false condition?
IF…ELSE
Which statement creates a table variable named @TestTable?
DECLARE @TestTable table;
What statement do you use to execute a dynamic SQL statement?
EXEC
Which statement can you use to repeatedly execute a statement or set of statements?
WHILE
Which statement tests whether the database named TestDB exists?
IF DB_ID (‘TestDB’) IS NOT NULL