The #table created by the first stored procedure needs to exist before the second stored procedure calling it can be created. Actually it is a rule that all the #tables referenced in a stored procedure must exist at the time of creating the stored procedure otherwise the stored procedure will not be created. This is irrespective of which stored procedure creates the #table initially.
The best practice is for you to create these objects in sequence in the same session as follows:
create #<TABLE_NAME> (...) go create procedure <PROC1> AS ... go create procedurte <PROC2> AS ... goPlease note that the #table must exist before either PROC1 or PROC2 can be created. It is also a good practice to ensure that PROC1 exists before PROC2 is created; otherwise you will get a warning.
Related Q&A from Mich Talebzadeh
Sybase expert Mich Talebzadeh explains how to log on in ASE.continue reading
Sybase expert Mich Talebzadeh gives fifteen reasons for why Sybase will definitely be around for years to come.continue reading
Sybase expert Mich Talebzadeh explains the syntax for user-defined Sybase functions.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.