-
November 22nd, 2007, 08:53 AM
#1
I'd like to know
Hello everybody!
I'd like to know what is really difference between Char and Varchar?
-
November 22nd, 2007, 09:09 AM
#2
Re: I'd like to know
A char will always take up the specified length, while a varchar will only take up the length of its value. I.e.:
A char(10) value set to 'Hello' will become (five spaces in the end; 10 characters in total.)
A varchar(10) value will remain as 'Hello'.
-
November 23rd, 2007, 06:54 AM
#3
Re: I'd like to know
In addition, SQL server stores extra data (2 bytes long as i remember) to determine the length of varchar and nvarchar data types.
In general to optimize both storage and data retrieval time, if your data does not exceed 10 characters, you should use char, if data will exceed 20 characters you should use varchar.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|