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.
Author |
Topic |
ravinder1483
Starting Member
9 Posts |
Posted - 2011-07-20 : 08:43:49
|
HI,I HAVE A WRAPPER SP WHOSE MAIN TASK IS TO CREATE A TEMP TABLE AND INSERT DATA INTO IT. NOW THE INSERTED DATA IS USED AS PARAMETER FOR SENDING MAIL FROM DATABSE..AFTER THE WRAPPER SP POPULATES TEMP TABLE AND INITIATES JOB, SQL JOB FURTHER CALLS ANOTHER SP..THE PURPOSE OF SECOND SP IS TO READ DATA FROM TEMP TABLE(CREATED IN WRAPPER SP) AND PASS THEM TO sp_send_dbmail AS PARAMETER..NOW THE ISSUE IS THAT TEMP TABLE IS SUCCESSFULLY POPULATING THE DATA, BUT SQL JOB LOGS ERROR 'Invalid object name #tmptable'..COULD ANYONE PLEASE TELL ME THAT IS IT GENUINE OR I AM DOING SOME THING WRONG IN MY CODE..Ravinder Pal SinghEmail: ravinder1483@gmail.com |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-07-20 : 08:48:21
|
thats because # table is becoming out of scope. Use a third sp and add both the calls inside that and create # table in this sp. this will make sure table is in scope for second sp call.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|