Home Forums Article Discussions Article Discussions by Author Discuss Content Posted by David Poole An Is Null Gotcha RE: An Is Null Gotcha
sean-653091
Old Hand
Points: 389
More actions
July 27, 2009 at 6:09 pm
#1030793
Yes, COALESCE seems to me to be a safer option. Try this:
DECLARE @vcOne varchar(10)
DECLARE @vcTwo varchar(20)
SET @vcTwo = '01234567890123456789'
SELECT ISNULL(@vcOne,@vcTwo)-- will truncate to 10
SELECT COALESCE(@vcOne,@vcTwo)-- won't