Archives

Archives / 2005 / November
  • xp_sprintf: Important Safety Tip

    While doing some T-SQL coding today against a SQL2K server I noticed a very frustrating issue: The xp_sprintf system stored procedure fails if the variable you send it to receive the formatted string is not long enough to hold the entire string. However, it doesn't tell you it fails. It just sets the string to a NULL and returns zero (Success). The @@ERROR server variable is also zero.