views:

44

answers:

3

Hello Experts,

I have 100000 Ids to store into our DataBase. Id is in string format.each id contain 10 char. So what is the best data type is for this data?

I have been used vrchar(max), text but my problem is not solved.

So please experts help me.

+3  A: 

why not just varchar(10), if that is the max. length? that way you avoid any off-row storage. Although you'll need a good reason to store a numeric valued column in a non-numeric column...

davek
I think question is not clear to you.I have 1000000 ids.so how can i store 1000000 string data into sql server 2005
PrateekSaluja
Why are you storing 1,000,000 records in one field on one row? Each data item should be in its own row. If it is a many-to-one or many-to-many relationship, then you're architecting the data model wrong.
Daniel DiPaolo
+1  A: 

If each id is exactly 10 characters, then use a char(10) field

Ray
well - trouble with char(10) is that every entry gets padded to 10 chars length. So if you store "abc" in the field, you really get "abc " - which can be a pain to find, later on. I'd prefer VARCHAR(10) - even for just 10 characters.
marc_s
which is why I said "If each id is exactly 10 characters"
Ray
A: 

varchar(10) assuming you have one ID per row and upto 10 characters

All 100000 in one varchar(max) is simply wrong... or have I misunderstood your intention?

gbn