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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help removing a table column in 6.5 2

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi I am using 6.5 and I want remove /delete one column without losing any data Is there any way to do it

thanks
reddy
 
You can use this script to delete the content of your column.

UPDATE yourtable
SET yourcolumn = null

If you want to completely drop the column from the table, you can do it in the table design view. I'm not sure if you can use ALTER table to delete a column in 6.5. In 7 you can do it this way...

ALTER TABLE yourtable
DROP COLUMN yourcolumn



Andel
andelbarroga@hotmail.com
 
You cannot drop a column in SQL 6.5. You must create new table like the first without the column you want to drop. Insert all data from the original table into the new table. Drop the original table. Rename the new table to the original name. If you have views or stored procedures that access the table, you must recompile them as well as remove references to the dropped column.
Terry
 
Hi,

If youre database cannot contain another table because there is no space available, the only way to drop a column of youre table is to create a view which produce the new structure of your table from the old table.

Then in DOS use the BCP command to export the data to a ASCII file. Then drop the table.

Now Create new table and use the BCP command to import the data.

If youre table contains a lot of records this may take a while.


JNC73
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top