Re: Alter command in SP



Thanks Hari, can you try this one. It wont work from my side.

create table xx( i int)
go
create proc xproc
as
Begin
alter table xx add j int
End
select * from xx where j is null
go

exec xproc
go
select * from xx


"Hari Prasad" <HariPrasad@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:54156A3D-DD59-4466-9BFC-BD94ADA4142C@xxxxxxxxxxxxxxxx
It works good for me in SQL 2000 and SQL 2005. See the sample below.

create table xx( i int)
go
create proc xproc
as
Begin
alter table xx add j int
End
go
exec xproc
go
select * from xx

Thanks
Hari

"Rogers" wrote:

Can I Alter any of the table through stored procedure. I tried but it
didn't
work, if any one guide then I would really appreciated.

Thanks





.



Relevant Pages

  • Re: Changing column type
    ... You are unable to perform an implicit conversion from datetime to int using ... ALTER TABLE, however there are several way to get around this. ... orderdate, 112)) AS OrderDate, ... ALTER TABLE northwind.dbo.orders ADD newcol INT NULL ...
    (microsoft.public.sqlserver.programming)
  • Re: Changing column type
    ... > ALTER TABLE, however there are several way to get around this. ... > ALTER TABLE northwind.dbo.orders ADD newcol INT NULL ... >> How can I change a column datatype from datetime to int using SQL?? ...
    (microsoft.public.sqlserver.programming)
  • fk name instead id
    ... ALTER TABLE WITH NOCHECK ADD ... CONSTRAINT PRIMARY KEY CLUSTERED ... ALTER TABLE [Table2] WITH NOCHECK ADD ...
    (microsoft.public.dotnet.framework.aspnet)
  • Need help with denormalizing query
    ... my_id INT NOT NULL, ... ALTER TABLE dbo.Related_Table ... I'm pretty sure that I will need to load a table with the data in this ... partitioned table with 6 partitions, each containting 35M+ rows, while ...
    (comp.databases.ms-sqlserver)
  • Syntax error in correct "alter table add..." statement (in loop)
    ... I've got this humongous stored procedure that generates a temporary table, ... An "alter table add.." ... alter table ##tmp add int ...
    (microsoft.public.sqlserver.programming)

Loading