Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Weird??? Stored Proc with out table

Author  Topic 

karuna
Aged Yak Warrior

582 Posts

Posted - 2007-08-10 : 14:11:03
Can someone tell me, how does this stored procedure gets created, even when the table t2 is not in the database.


CREATE PROC tsp2
AS
BEGIN
select col1 from t2
END
GO


I would normally expect it throw an compilation error with invalid object name, however it does throws error when I execute this.

Thanks
Karunakaran

rudesyle
Posting Yak Master

110 Posts

Posted - 2007-08-10 : 14:15:14
The stored proc won't get compiled until it is executed
Go to Top of Page

karuna
Aged Yak Warrior

582 Posts

Posted - 2007-08-10 : 14:32:50
Isnt this weird that it allows to a stored procedure when there is an invalid object?
Go to Top of Page

ashley.sql
Constraint Violating Yak Guru

299 Posts

Posted - 2007-08-10 : 14:39:13
Yes it is but not when u try to create a view
CREATE view vw_tsp2
AS
BEGIN
select col1 from t2
END
GO


Ashley Rhodes
Go to Top of Page
   

- Advertisement -