Friday, March 30, 2012

How to rename a column in SqlCE?

When I execute EXEC sp_rename 'PATHSPECIMEN.PVVALUE', 'PVPROC', 'COLUMN', I am getting the following error:
Major Error 0x80004005, Minor Error 25621
> EXEC sp_rename 'PATHSPECIMEN.PVVALUE', 'PVPROC', 'COLUMN'
The specified argument value for the procedure is not valid. [ Argument # = 3,Name of procedure(if known) = sp_rename ]

Could some one guide me where I am wrong?
I am executing this query against SqlCE in Sql Server 2005 Management Studio.

The sp_rename procedure is not avialable in SQL CE!

In Sql Server 2005 Management Studio you have to create a new column with the new name, then you have to update it with the values from your old column and then you have to delete your old column. The last action is difficult if the column is (part of) an index.

ALTER TABLE YOURTABLENAME ADD PVPROC INTEGER (or your datatype)
UPDATE YOURTABLENAME SET PVPROC = PATHSPECIMEN.PVVALUE
ALTER TABLE School DROP COLUMN PATHSPECIMEN.PVVALUE

I did it yesterday myself in this way!

Anne-Jan Tuinstra

|||Hi,

Thanks for your prompt reply and for the nice solution.

As you said that column is a part of index, how to go to resolve this case?.

Thanks
GSR|||

I think you/ I have to remove the index.

Up till now it didn't work with the manager.

My table now has one column to many!!!!!

No comments:

Post a Comment