I have query like:
Declare @count int
set @count=(select count(*) from table)
Alter table table
Add column1 int
Update table
Set column1=123
When I try to run this query, it complains that column1 does not exist. I can add a “GO” statement after
Alter table table
Add column1 int
GO
, but @count will be destroy.
Is there a way to resolve this problem?
Any help is very much appreciate.
Chaoma.
Declare @count int
set @count=(select count(*) from table)
Alter table table
Add column1 int
Update table
Set column1=123
When I try to run this query, it complains that column1 does not exist. I can add a “GO” statement after
Alter table table
Add column1 int
GO
, but @count will be destroy.
Is there a way to resolve this problem?
Any help is very much appreciate.
Chaoma.