datetime tune date into pad dynamic cursor money percent sp job isnumeric while over update
FREE TRIAL  SQL 2012 PROGRAMMING  SEARCH
SQL Server Scripts SQL 2005 SQL 2008 Articles
SQL JOBS NEWS FORMAT DEV JOBS
How to validate a date?

Execute the following Microsoft SQL Server T-SQL scripst in SSMS Query Editor to validate a date. It returns TRUE or FALSE (1 or 0):

SELECT  ISDATE('01/06/2008')

-- 1

SELECT  ISDATE(20101231)

-- 1

SELECT  ISDATE(GETDATE())

-- 1

SELECT  ISDATE(CURRENT_TIMESTAMP)

-- 1

SELECT  ISDATE('01/32/2012')

-- 0

SELECT DateCheck=Convert(varchar,CURRENT_TIMESTAMP) + ' IS A VALID DATE'

WHERE ISDATE(CURRENT_TIMESTAMP) = 1

-- Aug 16 2011  7:46AM IS A VALID DATE

-- ISDATE is language setting dependent

SELECT ISDATE('21/6/2012')

-- 0

SET LANGUAGE british

-- Changed language setting to British.

 

SELECT ISDATE('21/6/2012')

-- 1

Related article:

http://www.sqlusa.com/bestpractices/datetimeconversion/

BOL: ISDATE (Transact-SQL)

 

Exam Prep 70-461
Exam 70-461