• Oleg Netchaev (8/7/2010)


    I think that this data type size behaviour is great. Since there is no way in SQL Server to punish the disobedient by, say, 12 lashes they deserve, this difference is actually a good way to teach them to never omit the size when declaring / converting variables. On the top of the 1 / 30 issue, there is another interesting twist to it: both ADODB and ADO.NET default the size of the varchar type procedure parameter to 50 if the size is not specified. The bottom line is that forgetting to specify the size is evil and should be avoided.

    As far as a technical explanation is concerned, I believe that because the size is required, default values were provided by the parser team, and it probably just so happened that the declaration and conversion were written by different developers, that is all.

    Oleg

    You're right. Trusting default behaviours should be avoided at all costs.

    But 12 lashes is too soft. 😀

    Best regards,

    Andre Guerreiro Neto

    Database Analyst
    http://www.softplan.com.br
    MCITPx1/MCTSx2/MCSE/MCSA