More Conversion Fun

  • dun

    Say Hey Kid

    Points: 708

    Comments posted to this topic are about the item More Conversion Fun

  • hakan.winther

    SSCertifiable

    Points: 5827

    Someone may think this is a feature, but i think it is sad that SQL doesnt handle this as an error due to the fact that it is to easy skip optional parameters/statements, and some people does not have the fully understanding of why it is sometime very important. This laziness may lead to bugs.

    My recommendation is to never skip optional parameters or statements. It tends to be more code to write, but it is more secure.

    /Håkan Winther

    Senior Development DBA

    /Håkan Winther
    MCITP:Database Developer 2008
    MCTS: SQL Server 2008, Implementation and Maintenance
    MCSE: Data Platform

  • elbedata

    SSCarpal Tunnel

    Points: 4204

    Maybe the second alternative should have been "S"? "T" really doesn't make any sense at all. It really doesn't matter though, it's wrong anyway 🙂

    Lars Broberg
    Elbe-Data AB

  • Cliff Jones

    SSChampion

    Points: 10517

    Yes I agree. When "S" wasn't there I went looking for the correct answer.

  • Steve Jones - SSC Editor

    SSC Guru

    Points: 715101

    I changed the wrong answer to "S". Didn't notice that one before 🙂

  • Adam-424116

    Ten Centuries

    Points: 1240

    My only question is why I thought that when n wasn't specified in a cast/convert it was 50... good thing I never leave out those pesky optional variables in production code!

  • JF1081

    SSC Eights!

    Points: 982

    I wonder why 30?

  • john.arnott

    SSChampion

    Points: 11882

    So maybe if the second choice had still been "T", I would have picked another response. I am puzzled how I hadn't seen the default length of 30 before, yet the great majority of over 800 respondents to this QOD got it right. Oh, well. One more poke in the ribs that I've still got lots to learn.

    Of course I agree with others that it would be better not to depend on a default value, especially one as seemingly capricious as this one. Come to think of it, 30 makes some sense -- 30 characters and two more to hold the "real" length make 32, a power of two (just a guess).

  • JF1081

    SSC Eights!

    Points: 982

    Come to think of it, 30 makes some sense -- 30 characters and two more to hold the "real" length make 32, a power of two (just a guess).

    How much space does a char take? 8*32 = 256

  • dmbaker

    SSCertifiable

    Points: 5015

    I am puzzled how I hadn't seen the default length of 30 before, yet the great majority of over 800 respondents to this QOD got it right.

    Some of us learned this the hard way. :Whistling:

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply