Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
a_shipra
Starting Member
20 Posts |
Posted - 2004-08-04 : 23:51:42
|
| I have a column in table called post code which has maximum length = 4.Can you suggest me that i should use CHAR or VARCHAR?Also i want to use when should i use char instead of varcharThanks |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2004-08-05 : 00:04:06
|
| Use a CHAR fieldCHAR is used when you have a consistent length field. |
 |
|
|
a_shipra
Starting Member
20 Posts |
Posted - 2004-08-05 : 00:36:47
|
| hi timmy,do you mean that if there is a field of maximum length 50 then also i should use char? |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-08-05 : 00:45:33
|
| I think it's best to just follow the advice given in Books Online. I make anything over a length of four with a good variance in length a varchar. From BOL:Use char when the data values in a column are expected to be consistently close to the same size.Use varchar when the data values in a column are expected to vary considerably in size.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
a_shipra
Starting Member
20 Posts |
Posted - 2004-08-05 : 00:47:44
|
| Thanks for your help |
 |
|
|
|
|
|