Posts

Showing posts from January, 2021

SET Statements (Part 2)

Category Statements Descirption Syntax Ex Permission IMP To Remember ISO Settings statements SET ANSI_DEFAULTS Controls a group of SQL Server settings that collectively specify some ISO standard behavior. SET ANSI_DEFAULTS { ON | OFF } SET ANSI_DEFAULTS ON Public ANSI_DEFAULTS is a server-side setting which can enable the behavior for all client connections. When enabled (ON), this option enables the following ISO settings:SET ANSI_NULLS SET CURSOR_CLOSE_ON_COMMIT SET ANSI_NULL_DFLT_ON SET IMPLICIT_TRANSACTIONS SET ANSI_PADDING SET QUOTED_IDENTIFIER SET ANSI_WARNINGS SET ANSI_NULL_DFLT_OFF Alters the behavior of the session to override default nullability of new columns when the ANSI null default option for the database is true. SET ANSI_NULL_DFLT_OFF { ON | OFF } SET ANSI_NULL_DFLT_OFF OFF Public SET ANSI_NULL_DFLT_ON Modifies the behavior of the session to override default nullability of new columns when the ANSI null default option for the database is false. SET ANSI_NULL_DFLT_ON {O...

SET Statements (Part 1)

Have you ever used query options while executing query? Or have you ever tried to find out use of SET statements in query? If you are willing to understand this, then this blog is for you. SET Statements change the current session handling of specific information. Below table explains useful SET statements which often used in T-SQL. Category Statements Descirption Syntax Ex Permission IMP To Remember Date and time SET DATEFIRST Sets the first day of the week to a number from 1 through 7. SET DATEFIRST { number | @number_var } SET DATEFIRST 7 ; Public SET DATEFORMAT Sets the order of the month, day, and year date parts for interpreting date character strings. These strings are of type date, smalldatetime, datetime, datetime2, or datetimeoffset. SET DATEFORMAT { format | @format_var } SET DATEFORMAT dmy; Public Locking statements SET DEADLOCK_PRIORITY Specifies the relative importance that the current session continue processing if it is deadlocked with another session. SET DEADLOCK_...