all groups > sql server programming > july 2003 >
You're in the

sql server programming

group:

Changing image type to ntext via ALTER TABLE


Changing image type to ntext via ALTER TABLE dSQL
7/10/2003 11:00:09 PM
sql server programming:
Hi
Is there any way that we can change the data type of a
column from 'image' type to 'ntext' via the ALTER TABLE
command?

Re: Changing image type to ntext via ALTER TABLE oj
7/10/2003 11:19:19 PM
No. It's well documented.


--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net



[quoted text, click to view]

Re: Changing image type to ntext via ALTER TABLE Jacco Schalkwijk
7/11/2003 10:38:46 AM
As oj pointed out you can't, but it is easy to do in a few steps:

SELECT <primary_key>, image_column INTO #t FROM image_table
ALTER TABLE image_table DROP COLUMN image_column
ALTER TABLE image_table ADD image_column ntext NULL
UPDATE image_table
SET image_column = (SELECT image_column FROM #t
WHERE #t.<primary_key> = image_table.<primary_key>)

--
Jacco Schalkwijk MCDBA, MCSD, MCSE
Database Administrator
Eurostop Ltd.


[quoted text, click to view]

AddThis Social Bookmark Button