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 «««23456

Varchar or Char? Expand / Collapse
Author
Message
Posted Monday, November 2, 2009 4:02 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, March 24, 2014 4:01 PM
Points: 96, Visits: 85
We need to define a column that will contain externally provided identifiers. Their

(1) length will vary from seven to ten characters
(2) all English letters
(3) both upper and lower case mixed with numeric digits
(4) with an even distribution of lengths <--missed this point when answering, thus got it wrong [I said varchar(10)]

Which of these data types will be more efficient?

Correct answer nvarchar(25)...

Because...
(1) I don't care how many people you asked in management, this will change next week as soon as this is in PROD...you know that's true
(2) for now, but when you least suspect it/expect it you will have worry about localization...
(3) anh, moot point...see point 2
(4) unless this is a lookup table, this can only be the case if the number of records is evenly divisible by four, as you add one record at a time...unless all your batch inserts are also divisible by four and only then do you insert.

good question though, since the parameters were set as hypotheticals, but in the 'real' world those first set of constraints ALWAYS are wrong...LOL
Post #812645
Posted Monday, October 15, 2012 11:46 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, October 17, 2013 2:58 AM
Points: 245, Visits: 158
Realy good Question
keep it up John


There is no Wrong time to do a Right thing :)
Post #1373038
« Prev Topic | Next Topic »

Add to briefcase «««23456

Permissions Expand / Collapse