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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Char and Varchar?

Author  Topic 

wkm1925
Posting Yak Master

207 Posts

Posted - 2010-01-24 : 03:52:52
I want to store string. The size of this string not more than 30. Which data type need to choose? char or varchar?

Hope somebody tell me, for best practice char for what and varchar for what?

Kristen
Test

22859 Posts

Posted - 2010-01-24 : 05:31:58
If the string will always be exactly 20 characters long then use CHAR, if it will be between 0 and 20 characters then use VARCHAR
Go to Top of Page

wkm1925
Posting Yak Master

207 Posts

Posted - 2010-01-24 : 07:12:17
tq sir
Go to Top of Page
   

- Advertisement -