I use WPF C# Visual Studio and SQL Compact 3.5. On server explorer, I right click and select "Edit Table Schema", I can only change the data type, length,..etc but I cannot click into the Column Name to change the column name. How to change the column name in Server Explorer?
To change a column name, enter the following statement in your MySQL shell: ALTER TABLE table_name RENAME COLUMN old_column_name TO new_column_name; Replace table_name , old_column_name , and new_column_name with your table and column names.
Using SQL Server Management StudioIn Object Explorer, right-click the table in which you want to rename columns and choose Rename. Type a new column name.
In SSMS right click the Table and select Design. Change the name and click save. Done!
Sadly, this is not possible in SQL server CE. You will have to create a new column and then remove the old one. If you have any data in your column you will need to migrate this to your new column first. If you want to do it with an sql statement, try something like this:
ALTER TABLE myTable ADD newColumn newType
UPDATE myTable SET newColumn = oldColumn
ALTER TABLE myTable DROP COLUMN oldColumn
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With