| |

VerySource

 Forgot password?
 Register
Search
View: 667|Reply: 3

How do I change an ntext field to nvarchar in sql-server

[Copy link]

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-2-1 18:00:01
| Show all posts |Read mode
Field c in table t is of type ntext.

I used alter table [t] alter column [c] nvarchar (255)

It can be executed in sql2005, and an error is reported in sql2000. It seems that the ntext column cannot be changed.

Is there any solution
Reply

Use magic Report

0

Threads

211

Posts

108.00

Credits

Newbie

Rank: 1

Credits
108.00

 Unknown

Post time: 2020-3-20 11:15:01
| Show all posts
alter table [t] add [c1] nvarchar (255)

update [t] set [c1] = [c]

alter table [t] drop column [c]

EXEC sp_rename '[t]. [C1]', '[c]', 'COLUMN'
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-4-8 10:00:01
| Show all posts
Thank you, this is ok. But is there no simpler way? Such as system stored procedures. . . . .
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 Tunisia

 Author| Post time: 2020-6-13 12:15:01
| Show all posts
It can be changed directly in the Enterprise Manager. I don't think MS will leave an interface for myself, right?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list