I am using MS SQL server 2005 management studio. When I go to the "script
table as", the "alter to" is grey out but the other options such as "create
to", "select to" and etc ... are all available. I already login as sa. Can
anyone please help? Thanks.00KobeBrian wrote:
> I am using MS SQL server 2005 management studio. When I go to the "script
> table as", the "alter to" is grey out but the other options such as "create
> to", "select to" and etc ... are all available. I already login as sa. Can
> anyone please help? Thanks.
You can script procs, views and functions as ALTER scripts. You can't
do that with tables because there is no equivalent statement for
tables. For example the ALTER PROCEDURE statement really means
"recreate the entire procedure". ALTER TABLE on the other hand just
adds to the existing table structure.
The nearest equivalent would be to DROP and then CREATE the table - but
of course you lose your data if you do that.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||OK. Thanks.
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1163055114.197968.327260@.i42g2000cwa.googlegroups.com...
> 00KobeBrian wrote:
>> I am using MS SQL server 2005 management studio. When I go to the "script
>> table as", the "alter to" is grey out but the other options such as
>> "create
>> to", "select to" and etc ... are all available. I already login as sa.
>> Can
>> anyone please help? Thanks.
>
> You can script procs, views and functions as ALTER scripts. You can't
> do that with tables because there is no equivalent statement for
> tables. For example the ALTER PROCEDURE statement really means
> "recreate the entire procedure". ALTER TABLE on the other hand just
> adds to the existing table structure.
> The nearest equivalent would be to DROP and then CREATE the table - but
> of course you lose your data if you do that.
> --
> David Portas, SQL Server MVP
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
> SQL Server Books Online:
> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>
No comments:
Post a Comment