Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««1234»»»

Data Type and Length Expand / Collapse
Author
Message
Posted Monday, August 09, 2010 4:25 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, September 11, 2013 9:52 PM
Points: 125, Visits: 29
Very good question indeed. Takes back to basics
Post #965814
Posted Monday, August 09, 2010 6:45 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, May 19, 2011 7:26 AM
Points: 1,078, Visits: 289
Great Question. Thank you.
Post #965904
Posted Monday, August 09, 2010 7:22 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, July 22, 2013 1:05 AM
Points: 248, Visits: 373

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
Post #965940
Posted Monday, August 09, 2010 7:43 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, April 14, 2014 2:16 PM
Points: 2,812, Visits: 2,543
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.
Post #965950
Posted Monday, August 09, 2010 8:02 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 2:24 PM
Points: 11,990, Visits: 11,007
Excellent question! I noticed the lack of defining the size and my initial response was 1;1 but since that was not a choice I figured there must be something in convert for default sizes. Had there been an answer of 1;1 I would have assumed that was the correct answer.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #965968
Posted Monday, August 09, 2010 9:04 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Saturday, March 15, 2014 1:45 PM
Points: 405, Visits: 286
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 )
Post #966026
Posted Monday, August 09, 2010 3:01 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, April 07, 2014 2:34 PM
Points: 885, Visits: 188
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 ...
Post #966260
Posted Monday, August 09, 2010 5:56 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Thursday, April 10, 2014 3:50 PM
Points: 872, Visits: 952
Good question. Thank you!
Post #966314
Posted Tuesday, August 10, 2010 1:41 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 9:26 AM
Points: 115, Visits: 739
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.
Post #966974
Posted Wednesday, August 11, 2010 1:01 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 6:05 AM
Points: 1,528, Visits: 5,172
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?
Post #967180
« Prev Topic | Next Topic »

Add to briefcase ««1234»»»

Permissions Expand / Collapse