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)
 ntext to varchar(Max)

Author  Topic 

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-01-30 : 11:29:44
Hi I have an extremely large field (up to 250,000 characters long). (counted using Access)

I need to find out the Max length of this field in SQL, or change the datatype to varchar(max)

Any ideas?

Thanks

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-01-30 : 11:33:12
[code]select max(datalength(col1)) from Tbl[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-01-30 : 11:53:39
Many thanks

Is there anyway i can change the data type ntext to varchar(Max)?

Thanks
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-01-30 : 14:24:15
see alter table syntax in BOL:

http://msdn2.microsoft.com/en-us/library/ms190273.aspx

from BOL:

quote:
The data type of text, ntext and image columns can be changed only in the following ways:

* text to varchar(max), nvarchar(max), or xml
* ntext to varchar(max), nvarchar(max), or xml
* image to varbinary(max)



www.elsasoft.org
Go to Top of Page
   

- Advertisement -