September 19, 2007 at 3:49 am
Hi,
Can anyone please give me the exact difference between char,varchar,nchar nvarchar,varchar2 datatypes used in sql
Thanks in advance
Nisha
September 19, 2007 at 3:53 am
see SQL BOL.
Kishore.P
September 19, 2007 at 3:58 am
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/a54f7373-b247-4d61-8fb8-7f2ec7a8d0a4.htm
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
September 19, 2007 at 4:02 am
Hi,
I have seen it in BOL.
The size for char and varchar is given as 1 through 8000 bytes.
But in google when i searched it says that varchar stores upto 2000 and varchar2 stores upto 4000 bytes.Char stores upto 2000 bytes.
Can you please make it clear.
Thanks,
Nisha.
September 19, 2007 at 4:22 am
The char data type is a fixed-length ANSI character data type when the NOT NULL clause is specified. If a value shorter than the length of the column is inserted into a char NOT NULL column, the value is right-padded with blanks to the size of the column. For example, if a column is defined as char(10) and the data to be stored is "music", SQL Server stores this data as "music_____", where "_" indicates a blank.
The varchar data type is a variable-length ANSI character data type. Values shorter than the size of the column are not right-padded to the size of the column.
The nchar/nvarchar (national char, varchar) data type is a fixed-length/variable-lenght Unicode character data of n characters (n must be a value from 1 through 4,000).
You can use char/nchar when the data values in a column are expected to be consistently close to the same size or varchar/nvarchar when the data values in a column are expected to vary considerably in size.
September 19, 2007 at 4:29 am
Thanks Fracn
Could you please tell the size for each datatype
char,varchar and varchar2
September 19, 2007 at 4:38 am
Sorry, I posted before ending...
For char and varchar, n must be a value from 1 through 8000.
Does the Varchar2 exist for SQL? I know it's used by Oracle...
September 19, 2007 at 4:47 am
Yes Fracn
varchar2 is used by Oracle only
Thanks for your reply
Nisha
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply