multiple ALTER COLUMNs in one ALTER TABLE statement? 
Author Message
 multiple ALTER COLUMNs in one ALTER TABLE statement?

Hello,

I am afraid the answer is no but is there a way to do something like this:

ALTER TABLE mytable
    ALTER COLUMN col1 int,
    col2 float

I am taking a database that has been created by an upsizing wizard from
Visual FoxPro and all the numerics are set to float in SQL Server and I want
to use varchar on longer text fields (I'll ask about that in another post).
since many of the tables have 10 or more fields that need changing I just
used Enterprise Manager to Generate SQL for the database and used my text
editor to change the column values and change from CREATE to ALTER.

What I have now is a script with a lot of ALTER TABLEs that look like the
above but Query Analyzer is not liking it.

Thanks, Tom



Mon, 02 Sep 2002 03:00:00 GMT
 multiple ALTER COLUMNs in one ALTER TABLE statement?

Tom,

Good question!  It would appear from the SQL Server 7.0 Books Online
documentation on the ALTER TABLE command that your assumption is correct that to
alter multiple columns in a table, you have to issue multiple ALTER TABLE ...
ALTER COLUMN commands.


Quote:
> Hello,

> I am afraid the answer is no but is there a way to do something like this:

> ALTER TABLE mytable
>     ALTER COLUMN col1 int,
>     col2 float

> I am taking a database that has been created by an upsizing wizard from
> Visual FoxPro and all the numerics are set to float in SQL Server and I want
> to use varchar on longer text fields (I'll ask about that in another post).
> since many of the tables have 10 or more fields that need changing I just
> used Enterprise Manager to Generate SQL for the database and used my text
> editor to change the column values and change from CREATE to ALTER.

> What I have now is a script with a lot of ALTER TABLEs that look like the
> above but Query Analyzer is not liking it.

> Thanks, Tom



Mon, 02 Sep 2002 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Alter ALTER TABLE statement ...

2. Help with Alter Table Alter Column

3. Alter Table Alter Column Syntax

4. Alter table alter column

5. alter table alter column

6. Alter table alter column syntax

7. Alter table Alter column problem.

8. ALTER TABLE ... ALTER COLUMN IDENTITY

9. ALTER TABLE ALTER COLUMN

10. ALTER TABLE ALTER COLUMN to set Default

11. Alter table alter column text

12. syntax for ALTER TABLE ALTER COLUMN DEFAULT


 
Powered by phpBB® Forum Software