Can I delete a column in a table?

Can I delete a column in a table?

Post by Chan Ming Leon » Wed, 15 Apr 1998 04:00:00

I have some problems on microsoft SQL server.
1. I can add a column on a existing table but can I delete a column on a
existing table?
2. What is the difference between char and varchar? also can I make a
column with size larger than 255 char.
3. Can I change the datatype of a column eg. from real to int?
4. Can I change the size of a varchar column?
Thank you very much


Can I delete a column in a table?

Post by Neil Pik » Wed, 15 Apr 1998 04:00:00


 To do any of these you have to recreate the table.  Or get MS Visual
Interdev/Database Tools or SFI's SQL Programmer which will do the table
re-creation etc. behind the scenes for you.

 Neil Pike MVP/MCSE
 Protech Computing Ltd


Can I delete a column in a table?

Post by Alan McKelvi » Wed, 15 Apr 1998 04:00:00

Yes to all with visual interdev. However, I will caution you about making a
column wider than 255 characters. There are several bugs in SQL with wide
text columns that can cause severe data corruption resulting in chaos.
Service pack 4 helps, but does not fix the problem. I suggest that if you
need more than 255 chars, use embedded OLE fields (binary data type)  that
link to WP documents instead of relying on SQL varchar data types.
alan mckelvie


1. Dropping column silently kills multi-coumn index (was [ODBC] Error when accessing tables with deleted columns)

I see the connection you're trying to make there, but I don't think it
quite follows.  When you drop a table, all its indexes logically become
orphaned and so can be quietly dropped; who would expect the indexes to
stay?  When you drop a column that belongs to a multi-column index on
the other hand, the index does not become logically orphaned.  It
becomes... Something else...  I think it could be an intuative
expectation that the server should re-structure the index minus the
dropped field.  In other words, the index *can* exist without the
dropped field, just not in its current form.  Because of that
uncertainty, it makes sense to me to refuse to drop the column.  The
reason I suggested the same behavior for *single* column indexes is
purely for constistancy.

The post that got me looking into this showed that exact uncertainty;
there was a question whether the index was dropped or not.

And no, requiring CASCADE on table drops to get rid of indexes makes
exactly zero sence to me :-)


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly

2. Copy Database Wizard problems

3. setup issue SP2

4. instead of delete trigger delete data from table using execute and temporary table for deleted

5. help! 2 versions of odbc admin

6. mess delete common column in all tables

7. Can't load in IE???

8. How to delete a column in a table?

9. Deleting a Column from a Table via SQL

10. Dropping/delete a table column ...


12. Help deleting/adding columns to MDB tables