delphidestructor
Programmer
- Oct 20, 2000
- 67
Can anyone tell me why the first works in a sp and the second doesn't?
1)
CREATE PROCEDURE w_z_testing AS
create table #t_table (f1 int, f2 int)
alter table #t_table add f3 int
insert into #t_table (f1, f2) values (2,3)
select * from #t_table
GO
RETURNS:
(1 row(s) affected)
f1 f2 f3
----------- ----------- -----------
2 3 NULL
////////////////////////////////////////////
2)
CREATE PROCEDURE w_z_testing AS
create table #t_table (f1 int, f2 int)
alter table #t_table add f3 int
insert into #t_table (f1, f2, f3) values (2,3,4) <--
select * from #t_table
GO
RETURNS:
Server: Msg 207, Level 16, State 1, Procedure w_z_testing, Line 4
Invalid column name 'f3'.
Mike
1)
CREATE PROCEDURE w_z_testing AS
create table #t_table (f1 int, f2 int)
alter table #t_table add f3 int
insert into #t_table (f1, f2) values (2,3)
select * from #t_table
GO
RETURNS:
(1 row(s) affected)
f1 f2 f3
----------- ----------- -----------
2 3 NULL
////////////////////////////////////////////
2)
CREATE PROCEDURE w_z_testing AS
create table #t_table (f1 int, f2 int)
alter table #t_table add f3 int
insert into #t_table (f1, f2, f3) values (2,3,4) <--
select * from #t_table
GO
RETURNS:
Server: Msg 207, Level 16, State 1, Procedure w_z_testing, Line 4
Invalid column name 'f3'.
Mike