|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 9:35 AM
Points: 2,749,
Visits: 1,407
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Sunday, May 21, 2006 10:09 AM
Points: 3,
Visits: 1
|
|
Experience suggests...if user says data is being truncated ,first check the size of any fields (or intermediate fields) used to store that data. Regards HMC
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Wednesday, September 24, 2008 3:30 PM
Points: 80,
Visits: 2
|
|
| That's not a gotcha, that's a "Man you wasted valuable development hours to figure that out!"
|
|
|
|
|
SSCrazy Eights
        
Group: Moderators
Last Login: Tuesday, April 09, 2013 12:53 PM
Points: 8,357,
Visits: 684
|
|
Title should have read IsNull and not Is Null. However interesting effect as you found out. Example. declare @x varchar(5) select isnull(@x,'1234567890') From BOL Argumentscheck_expression Is the expression to be checked for NULL. check_expression can be of any type. replacement_value Is the expression to be returned if check_expression is NULL. replacement_value must have the same type as check_expresssion. Keep in mind type is not varchar but the varchar(5). Many folks forget that.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 4:39 PM
Points: 6,260,
Visits: 1,977
|
|
Thank you very much for your leg work it is something difficult to spot and definitely will go into my bag of "check before release" 
* Noel
|
|
|
|
|
SSCertifiable
       
Group: Moderators
Last Login: Thursday, May 09, 2013 12:38 PM
Points: 6,462,
Visits: 1,384
|
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 9:35 AM
Points: 2,749,
Visits: 1,407
|
|
If you look on the Microsoft SQL Server site you will see that there is a books on-line update dated January 2004. You can tell if you need the update by looking at the documentation for the sp_addlogin stored procedure. If example E for copying passwords says CONVERT(VARBINARY(32),[Password]) instead of CONVERT(VARBINARY(256),[Password]) then you need to update BOL.
LinkedIn Profile
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Friday, November 19, 2004 2:00 PM
Points: 131,
Visits: 1
|
|
excellent article . . . both for the "gotcha" and as a reminder to do your homework . . . lookup "Using Data Types" in bol. type AND length are specified as two of the four attributes of a data type assignment.
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Today @ 10:34 AM
Points: 265,
Visits: 635
|
|
I enjoyed this article, good description of problem solving exercise. But I don't think the title or any focus on isnull() is right. Assume some other function was used instead of isnull--maybe upper() for the sake of argument. Still would have had same problem with truncation. The problem was with variable declaration & fact that escaping process expanded size of string. I've seen more problems related to isnull() or lack of it than almost any other single area, but this is not one of them.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, March 02, 2009 3:01 AM
Points: 13,
Visits: 10
|
|
Isn't Coalesce preferred over IsNull, being ansi standard and all? You wouldn't have had this problem anyway...
|
|
|
|