What Is a Statement in SQL Server Transact-SQL

Q

What is a statement in SQL Server Transact-SQL?

✍: FYIcenter.com

A

A statement in SQL Server Transact-SQL is a single smallest execution unit. Here are some examples of Transact-SQL statements:

  • "PRINT 'Hello World!';" - An output statement that print a character string to the console.
  • "SELECT GETDATE();" - A query statement that returns a list of values.
  • "CREATE TABLE ...;" - A data definition language statement that defines a table.
  • "INSERT INTO ...;" - A data manipulation language statement that inserts data into a table.
  • "SELECT * FROM ...;" - A query statement that returns data from a table.
  • "DROP TABLE ...;" - A data definition language statement that deletes a table.
  • "DECLARE @name data_type;" - A declaration statement that defines a local variable.
  • "SET @name = expression;" - An assignment statement that assigns a value to a local variable.
  • "BEGIN TRANSACTION;" - A transaction management statement that marks the beginning of a transaction.
  • "ROLLBACK TRANSACTION;" - A transaction management statement that rolls back all changes of a transaction.

 

Start and End of Statement in SQL Server Transact-SQL

Is SQL Server Transact-SQL Case Sensitive?

General Questions on Microsoft SQL Server Transact-SQL

⇑⇑ SQL Server Transact-SQL Tutorials

2017-05-29, 1691🔥, 0💬