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
 SQL Server Administration (2005)
 problem in compile Proc

Author  Topic 

chih
Posting Yak Master

154 Posts

Posted - 2009-08-05 : 21:36:43
Hi all,

Recently I found that there is an issue when I create/alter a stored procedure. If there is wrong table name or missing table in stored procedure, i am still able to create/alter it without any error.

Do I miss something? Is that normal?

Thank you in advance

ahmad.osama
Posting Yak Master

183 Posts

Posted - 2009-08-06 : 06:29:12
quote:
Originally posted by chih

Hi all,

Recently I found that there is an issue when I create/alter a stored procedure. If there is wrong table name or missing table in stored procedure, i am still able to create/alter it without any error.

Do I miss something? Is that normal?

Thank you in advance



As per me, this is a known isu in sql server....
Go to Top of Page

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-08-06 : 08:26:50
quote:
Originally posted by chih

Hi all,

Recently I found that there is an issue when I create/alter a stored procedure. If there is wrong table name or missing table in stored procedure, i am still able to create/alter it without any error.

Do I miss something? Is that normal?

Thank you in advance



SQL Server allows the creation of stored procedures that reference tables that do not yet exist. At creation time, only syntax checking is done. The stored procedure is compiled to generate an execution plan when executed if a valid plan does not already exist in the cache. Only during compilation are all objects referenced in the stored procedure resolved. Thus, a syntactically correct stored procedure that references tables that do not exist can be created successfully; however, the store procedure will fail at run time if the referenced tables do not exist.





-------------------------
R..
http://code.msdn.microsoft.com/SQLExamples/
http://msdn.microsoft.com/hi-in/library/bb500155(en-us).aspx
Go to Top of Page

chih
Posting Yak Master

154 Posts

Posted - 2009-08-09 : 20:55:56
It is really intersting. I found
1. It allows to have reference tables that do not yet exis. Even the column name is incorrect.
2. If all reference tables exist but column is wrong or not exists, error will occur.
Go to Top of Page
   

- Advertisement -