|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, September 18, 2012 4:53 AM
Points: 123,
Visits: 28
|
|
Very good question indeed. Takes back to basics
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, May 19, 2011 7:26 AM
Points: 1,078,
Visits: 289
|
|
| Great Question. Thank you.
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Tuesday, January 01, 2013 11:12 PM
Points: 248,
Visits: 372
|
|
Good question. Thank you.
KSB ----------------------------- Thousands of candles can be lit from a single candle, and the life of the candle will not be shortened. Knowledge and happiness never decreases by being shared.” - Buddha
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 1:10 PM
Points: 2,673,
Visits: 2,418
|
|
Curious, the difference in default behaviour between a DECLARE and a CONVERT.
I suppose this just puts another check mark in the Always Declare Everything column.
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Yesterday @ 1:17 PM
Points: 8,641,
Visits: 8,273
|
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Thursday, May 02, 2013 10:26 AM
Points: 404,
Visits: 274
|
|
Thanks very much! This is a question that applies to the category of "things I need to know and will probably run across" and the answer is straight-forward/simple! Ok, I got it wrong, but that's because I have plenty to learn.
(The last couple times I've commented, it was due to being frustrated with the question, thought I might add some positive feedback as well )
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 1:09 PM
Points: 778,
Visits: 164
|
|
This is a very good question. My initial choice was 3/38. It's a good thing I decided to run the code before answering. I learned something new ...
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Wednesday, April 10, 2013 3:04 PM
Points: 839,
Visits: 938
|
|
| Good question. Thank you!
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, May 07, 2013 3:28 AM
Points: 115,
Visits: 719
|
|
I got it wrong too. But like many questions here, the answer depends on knowing the many inconsistencies and strange rules in SQL Server - most of which you never need to know.
I had no idea how long char and varchar default sizes are, for the simple reason that I've never declared any without specifying the length. IMHO the correct answer should have been 'Syntax Error'!
It would be nice to have a datatype like .NET's string which can carry strings of (almost) any length without worrying about what its contents' maximum length might happen to be. Fields in database tables may need to be specified precisely; local variables should not.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 7:27 AM
Points: 1,259,
Visits: 4,260
|
|
David Data (8/10/2010) It would be nice to have a datatype like .NET's string which can carry strings of (almost) any length without worrying about what its contents' maximum length might happen to be. Fields in database tables may need to be specified precisely; local variables should not.
Isn't that pretty much what VARCHAR(MAX) is?
|
|
|
|