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)
 Memo field in SQL Server 2005?

Author  Topic 

mojpro
Starting Member

15 Posts

Posted - 2007-04-22 : 13:42:15
Has anyone experienced problem with ntext as memo field?
What is the proper field type? text? ntext, nvarchar, varchar?

Thanks.

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-04-22 : 13:49:19
I believe it would be varchar(max)


************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

mojpro
Starting Member

15 Posts

Posted - 2007-04-22 : 13:52:52
wonderful! Thanks a lot.

Shall I determine "max", like:
varchar(2000) ?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-04-22 : 15:14:49
no. you use varchar(max)
max is a keyword not a number you should put in.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

mojpro
Starting Member

15 Posts

Posted - 2007-04-22 : 15:57:38
Thank you Spirit1
Go to Top of Page

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2007-04-24 : 10:26:58
quote:
Originally posted by spirit1

no. you use varchar(max)
max is a keyword not a number you should put in.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp



max is a keyword not a number you should put in.
so does it mean, u can specify any upper, more than 8000, limit for storing data for VARCHAR? if no, then what is the maximum limit for such datatype in SQL 2005.

thanks in advance,

Mahesh
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-04-24 : 10:38:31
you must use it like this:

declare @var varchar(max)
select @var = replicate('abcd ', 5000)
select @var

read about this in BOL = books online = sql server help.
this will be 25000 bytes long

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-24 : 11:18:05
I believe VARCHAR(MAX) is 2,147,483,647 bytes long. Exactly as old datatype TEXT was.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -