Renaming A Column in SQLCE

Because of Compact Edition's limited features, to rename a column you need to create a new column with the desired name, copy any data from the old column to the new, and finally delete the old column. The example below renames an integer column in SQLCE.
 
Jimmy
 
[code:vb]

ALTER TABLE MyTable ADD NewColumnName INTEGER

UPDATE MyTable SET NewColumnName = OldColumnName

ALTER TABLE MyTable DROP COLUMN OldColumnName[/code]

 

Related posts

Comments

Add comment


 

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

February 6. 2012 05:56

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2012