More Conversion Fun

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

  • 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

  • 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

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

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

  • 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!

  • I wonder why 30?

  • 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).

  • 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

  • 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 9 (of 9 total)

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