Printed 2017/08/18 06:19PM

SET clause in SQL Server (2008/2005)

By Dukagjin Maloku, 2010/05/07

SET clause in SQL Server uses in combination with other clauses to change the current behavior of the SQL Server in current sessions. Many of the default settings of the SQL Server that was setting up before, can be changed with SET command, like date format, or first day of the week, or transaction explicit | implicit state etc.

I use very often SET DATEFORMAT dmy, according to my location date format, and there are some SET statement examples:

SET DATEFORMAT DMY --setting the date time format Day Month Year

SET DATEFIRST 1 -- that means that the start day of the week is Monday.

SET IMPLICIT_TRANSACTION ON or OFF --setting implicit or explicit transaction state in current session.

SET IDENTITY_INSERT table_name ON or OFF --setting the Identity Insert in to the identity column of the table.


Check the full list of the SET command in combination with other statements, here

Stay Tuned!

Copyright © 2002-2017 Redgate. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.