What is a trigger in T-SQL?
- A trigger is a special type of stored procedure that is automatically executed in response to certain events, such as an insert, update, or delete operation on a table.
What is the IF statement used for in T-SQL?
The IF statement is used to execute a block of code if a certain condition is true.
What is the difference between the AND and OR operators in T-SQL?
The AND operator returns true if both conditions are true, while the OR operator returns true if either condition is true.
What is data conversion in T-SQL?
What is CAST and in T-SQL?
Data conversion is the process of converting one data type to another data type.
CAST is a function that converts an expression of one data type to another data type.
CONVERT is a function that converts an expression of one data type to another data type.
What is metadata in SQL Server?
Metadata refers to information about database objects such as tables, columns, indexes, and constraints.
What are the types of triggers in T-SQL?
- There are two types of triggers in T-SQL: After Triggers and Instead of Triggers.
What is the WHILE statement used for in T-SQL?
The WHILE statement is used to execute a block of code repeatedly as long as a certain condition is true.
How do you use the NOT operator in T-SQL?
You can use the NOT operator in T-SQL to negate a condition.
What is CONCAT and SUBSTRING in T-SQL?
CONCAT is a function that concatenates two or more strings into a single string.
SUBSTRING is a function that returns part of a string based on its starting position and length.
How do you view metadata for columns in SQL Server?
You can view metadata for columns in SQL Server by querying system views such as sys.columns or INFORMATION_SCHEMA.COLUMNS.
What are the special tables used by triggers in T-SQL?
Triggers use two special tables called inserted and deleted. The inserted table contains the new data that was inserted into the table, while the deleted table contains the old data that was deleted from the table.
What is @@ROWCOUNT in T-SQL?
What is the difference between @@ROWCOUNT and @@IDENTITY in T-SQL?
@@ROWCOUNT is a system function that returns the number of rows affected by the last statement executed.
while @@IDENTITY returns the last identity value generated for any table in the current session.
What is the difference between the LIKE and IN operators in T-SQL?
The LIKE operator is used to compare a string to a pattern, while the IN operator is used to compare a value to a list of values.
How do you concatenate multiple columns into a single string in T-SQL?
You can concatenate multiple columns into a single string in T-SQL by using the CONCAT function or by using the + operator.
How do you view metadata for indexes in SQL Server?
You can view metadata for indexes in SQL Server by querying system views such as sys.indexes or sys.index_columns.
How do you create a trigger in T-SQL?
You can create a trigger using the CREATE TRIGGER statement.
What is ISNULL in T-SQL?
ISNULL is a function that returns a specified value if an expression is NULL, otherwise it returns the expression itself.
What are logical operators in T-SQL?
Logical operators are used to combine two or more conditions into a single condition. The logical operators in T-SQL are AND, OR, and NOT.
What is the difference between CHARINDEX and PATINDEX in T-SQL?
CHARINDEX and PATINDEX are both used to search for a pattern within a string in T-SQL. CHARINDEX searches for an exact match, while PATINDEX searches for a pattern match using wildcards.
How do you view metadata for stored procedures in SQL Server?
You can view metadata for stored procedures in SQL Server by querying system views such as sys.procedures or INFORMATION_SCHEMA.ROUTINES.
How do you disable a trigger in T-SQL?
You can disable a trigger in T-SQL by using the ALTER TABLE statement with the DISABLE TRIGGER option.
What is the difference between the IF and CASE statements in T-SQL?
The IF statement is used to execute a block of code if a certain condition is true, while the CASE statement is used to evaluate a list of conditions and return a value based on the first condition that is true.
How do you remove leading or trailing spaces from a string in T-SQL?
You can remove leading or trailing spaces from a string in T-SQL by using the LTRIM and RTRIM functions.
How do you view metadata for tables in SQL Server?
You can view metadata for tables using system views such as sys.tables and sys.columns.