Jump to content

Modify (alter) a column not drop or addnew


tariq_ews

Recommended Posts

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
If 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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...