Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rajnidas
Yak Posting Veteran
97 Posts |
Posted - 2015-02-03 : 06:36:27
|
MY CODE IS NOT RUNNING.IT SHOULD PRINT '1900-01-01' BCOZ TEST TABLE IS BLANK.DECLARE @CHKDT1 AS DATESELECT @CHKDT1 = MAX(CONVERT(DATE,COMPUTEDATE,121)) FROM testIF (@CHKDT1 = '' OR @CHKDT1 = NULL)BEGIN SET @CHKDT1 = CONVERT(DATE,'1900-01-01',121)ENDprint @CHKDT1THANKS,RAJNI |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2015-02-03 : 09:53:31
|
In SQL, "@CHKDT1 = NULL" is always FALSE.Perhaps you mean "@CHKDT1 IS NULL" |
|
|
|
|
|