tariq_ews Posted October 18, 2007 Share Posted October 18, 2007 Hello everybody i am new and i have a problem that we want to change my table column not add or not remove it just change how can i do it plz helpregards Muhammad Tariq Link to comment Share on other sites More sharing options...
Reg Edit Posted October 18, 2007 Share Posted October 18, 2007 Hello everybody i am new and i have a problem that we want to change my table column not add or not remove it just change how can i do it plz helpregards Muhammad TariqIf you're using MS SQL you can do it with sp_rename. See http://msdn2.microsoft.com/en-us/library/ms188351.aspx for further info on this. Renaming can get complicated if there are indexes, constraints and suchlike that relate to the item being renamed... Link to comment Share on other sites More sharing options...
justsomeguy Posted October 18, 2007 Share Posted October 18, 2007 If you have MS SQL Server you can just open up the Enterprise Manager, right-click on the table and go to Design View, and change whatever you want. Most database servers have a GUI you can use (like phpMyAdmin for MySQL). If you need to use a SQL statement to do it, that statement is an ALTER TABLE statement.http://www.google.com/search?client=opera&...-8&oe=utf-8 Link to comment Share on other sites More sharing options...
Reg Edit Posted October 19, 2007 Share Posted October 19, 2007 If you have MS SQL Server you can just open up the Enterprise Manager, right-click on the table and go to Design View, and change whatever you want. Most database servers have a GUI you can use (like phpMyAdmin for MySQL). If you need to use a SQL statement to do it, that statement is an ALTER TABLE statement.http://www.google.com/search?client=opera&...-8&oe=utf-8 I believe some SQL implementations use ALTER TABLE for this, but not, for example, MS SQL. See the MS SQL info on modifying column properties where it shows that you use ALTER TABLE to set column properties, and sp_rename to rename a column. So your SQL syntax for changing the column name will depend on the SQL engine you're using (MS SQL, MySQL, ...). Which SQL engine are you using? Link to comment Share on other sites More sharing options...
tariq_ews Posted October 20, 2007 Author Share Posted October 20, 2007 justsomeguy, Reg Edit thanks for urs help i only want sql server statement for this and i have got itEXEC sp_rename 'Sales.SalesTerritory', 'SaleANDGOEXEC sp_rename 'Sales.SalesTerritory.TerritoryID', 'TerrID', 'COLUMN';thanks a lot 4 allRagards Tariq Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.