• SanjayAttray (7/18/2010)


    Nice question.

    When the length is not specified in a data definition or variable declaration statement, the default length is 1 ----- Didn't knew this. used to give length to all variables.

    And I really hope that you continue to give length to all variables. Relying on this default length is bad practice. And very confusing, since the default length depends on where the data type is used - in a CONVERT or CAST function, the default is 30; elsewhere it is 1.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/