Skip to content

Instantly share code, notes, and snippets.

@James-McNeill
Created January 26, 2022 17:41
Show Gist options
  • Save James-McNeill/4962ab4854e82d0861f469777f2e41bd to your computer and use it in GitHub Desktop.
Save James-McNeill/4962ab4854e82d0861f469777f2e41bd to your computer and use it in GitHub Desktop.
DECLARE @date1 NVARCHAR(20) = '10.01.2022';
-- Set the date format and check if the variable is a date
SET DATEFORMAT mdy;
--PRINT @date1;
SELECT ISDATE(@date1) AS result
, @date1 AS review_date;
GO
-- By using the GO keyword we have segmented the code and now the interpreter does not know
-- what the local variable @date1 is
SELECT ISDATE(@date1) AS result
, @date1 AS review_date;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment