Pattycake245
Programmer
I am working on a stored procedure where a local temporary table is being created when I ran across this in books online:
"A local temporary table created in a stored procedure is dropped automatically when the stored procedure completes. The table can be referenced by any nested stored procedures executed by the stored procedure that created the table. The table cannot be referenced by the process which called the stored procedure that created the table."
I create a couple of strings dynamically and then execute them one at a time. The first creates the temporary table, the second string populates the table and the third pulls data from that table. For whatever reason, after that table is created the second string will not execute because it says the temporary table is not a valid object. I've checked the spelling and everything is correct. So, do temporary tables exist until a strored procedure is finished or do they exist only inside the string which is creating it?
Any help or past experience to share regarding this would be appreciated?
Tim
"A local temporary table created in a stored procedure is dropped automatically when the stored procedure completes. The table can be referenced by any nested stored procedures executed by the stored procedure that created the table. The table cannot be referenced by the process which called the stored procedure that created the table."
I create a couple of strings dynamically and then execute them one at a time. The first creates the temporary table, the second string populates the table and the third pulls data from that table. For whatever reason, after that table is created the second string will not execute because it says the temporary table is not a valid object. I've checked the spelling and everything is correct. So, do temporary tables exist until a strored procedure is finished or do they exist only inside the string which is creating it?
Any help or past experience to share regarding this would be appreciated?
Tim