Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

length for varchar data

Status
Not open for further replies.

FoxWing

Programmer
Dec 20, 2004
44
GB
Hi,

I'm a beginner in MSSQL.

When i convert from char to varchar in the table, i noticed that by default varchar is using 50 length.

What would be the impact in term of space consumption if i leave it as 50 althought i only need 10 since varchar is in variable length. What i'm think is, if next time i need more, i do not need to change the structure as it already able to accomadate 50 characters max.

Kindly advice.

Thanks.
 
Although there would be no actual space-saving advantages as varchar data only uses space for the actual amount of characters in the value, it is best practice to set the maximum length to the actual max length you plan on needing. If you didn't, you might as well have every varchar column set to 8000 char max!

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top