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 2000 Forums
 SQL Server Development (2000)
 difference between data types

Author  Topic 

Hippi
Yak Posting Veteran

63 Posts

Posted - 2005-01-25 : 16:08:14
Could you guys tell me what is the difference between CHAR, VARCHAR and NVARCHAR?

Thanks

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-01-25 : 16:25:06
well BOL has good answers but:

declare @a char(10)
declare @b varchar(10)
declare @c nvarchar(10)
select @a = '12345', @b = '12345', @c = '12345'

select len(@a) as [len A], datalength(@a) as [datalength A],
len(@b) as [len B], datalength(@b) as [datalength B],
len(@c) as [len C], datalength(@c) as [datalength C]


Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -