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
 Transact-SQL (2000)
 How do I transform nvarchar(3000) to ntext?

Author  Topic 

Zim327
Yak Posting Veteran

62 Posts

Posted - 2005-03-08 : 14:15:19
I tried changing it in design view but it failed miserably.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-08 : 14:17:32
i don't recommend doing that. text fields just bring problems...

declare @t nvarchar(3000)
set @t = replicate('a', 2000)
select @t, convert(ntext, @t)


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

Zim327
Yak Posting Veteran

62 Posts

Posted - 2005-03-08 : 14:25:37
quote:
Originally posted by spirit1

i don't recommend doing that. text fields just bring problems...

declare @t nvarchar(3000)
set @t = replicate('a', 2000)
select @t, convert(ntext, @t)


Go with the flow & have fun! Else fight the flow



Hi spirit1,
Thanks for the quick reply. I should have mentioned that I have a table with lots of data in it and I need to preserve all the data while expanding the nvarchar(3000) to ntext. It's a survey db and a lot of the respondents are on the verbose side.
Is there an easy way to do this?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-08 : 14:29:34
the best way is:
1. put the data from you table into a temp table.
2. drop the table and indexes
3. create a table with ntext field
4. insert data from temp table into new table
5. recreate indexes.

5 minutes and you're done.


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

Zim327
Yak Posting Veteran

62 Posts

Posted - 2005-03-08 : 14:48:25
how exactly do I recreate the indexes?
I want the numbering to start back up right where it stopped at 13717
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-08 : 15:00:44
create index .... blah blah... whatever index you have now.... look the syntax in BOL. or just do it in Enterprise manager.
well you can insert into an idetity column if you do:
SET IDENTITY_INSERT YourColumnName ON



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

Zim327
Yak Posting Veteran

62 Posts

Posted - 2005-03-08 : 15:45:39
It worked!
thanks for your help spirit1!

Best regards,

Zim
Go to Top of Page
   

- Advertisement -