Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting a column from Table 1

Status
Not open for further replies.

PureNSimple

Programmer
Oct 2, 1998
13
0
0
US
Well I add a column to a table by using ALTER table command. Now I want this column to be removed. This column does not contain any data. Tell me how to do this???
 
Use the SELECT INTO command to select only the column you want from the source table INTO the new table. You can even reorganize the sequence of the columns this way. After, drop the source table and sp_rename the new table or do another SELECT INTO the original name from that new table.<br>
<br>
You can also use this way to insert a new column "in between" existing column, like:<br>
<br>
SELECT Ca, Cb, Cc, "MyNewCol"=convert(varchar(20)), Cd INTO MyNEWTable<br>
FROM MyCURRENTTable<br>
<br>
Hope this help.<br>
<br>
Sylvain Faust<br>
President<br>
Sylvain Faust Intl (SFI)<br>
880 boul. de la Carriere, Suite 130<br>
Hull, Quebec, Canada J8Y 6T5<br>
<br>
SQL-Programmer 2.VIII:<br>
"The best SQL integrated development environment we've seen, earning<br>
PC Week Labs' Analyst's Choice honors." [Oct. 26, 1998]<br>
<br>
Tel: (819) 778-5045, Ext. 804<br>
Toll Free: 1-800-567-9127 (U.S. and Canada only)<br>
Fax: (819) 778-7943 International; (617) 722-9389 U.S. only<br>
Email: sfaust@sfi-software.com<br>
<br>
Sylvain Faust Inc. (SFI)<br>
Delivering SQL Solutions, Since 1988<br>
<br>
To receive news bulletins from SFI automatically, just send a blank email to:<br>
SFI-NEWS-SUBSCRIBE-REQUEST@peach.ease.lsoft.com<br>
<br>
SFI Online Store:<br>
<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top