December 6, 2008 at 4:26 am
hello friends
is any different between this kind of declaration for Table field :
[Name] varchar(100) or [Name] varchar(1000)
consider Name length will not be more than 50 characters !
December 6, 2008 at 10:23 am
You might want to read this article:
http://support.microsoft.com/kb/154886
for how varchar values are stored. It also contains very simple sample code so that you can test and view the results of the ANSI_Padding settings. With this understanding I assume you can answer your own question.
Then read this article so as to prepare for the future, i.e., potential future upgrades.
December 6, 2008 at 11:20 pm
bitbucket (12/6/2008)
You might want to read this article:http://support.microsoft.com/kb/154886
for how varchar values are stored. It also contains very simple sample code so that you can test and view the results of the ANSI_Padding settings. With this understanding I assume you can answer your own question.
Then read this article so as to prepare for the future, i.e., potential future upgrades.
Thanks,i read the article.
i have a question?could we say use varchar instead char in everywhere or using char has benefit ?
December 7, 2008 at 5:57 pm
The answer like most answers to SQL questions is "That depends"
These 2 BOL pages should give you the guidance you need for your databases.
1. To understand the effect of ANSI_Padding setting
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/07cc67f6-5057-463b-8975-694a5b484926.htm
2. Microsoft makes the following recommendations
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/282cd982-f4fb-4b22-b2df-9e8478f13f6a.htm.
It basically boils down to:
Use char when the sizes of the column data entries are consistent.
Use varchar when the sizes of the column data entries vary considerably.
Use varchar(max) when the sizes of the column data entries vary considerably, and the size might exceed 8,000 bytes.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply