Link to home
Start Free TrialLog in
Avatar of robrodp
robrodpFlag for Mexico

asked on

ms sql temporary tables. Create and access via asp

I create a temporary table (asp query):
select top 0 * into #payuvars from payuvars
No Problems

I cans ee it in the the temopb database
the I try to insert (asp query)
insert into #payuvars(payuvar,payuval) values('val1','val2')

I get:

Invalid object name '#payuvars'.

What am I doing wrong?
ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I don't agree with the suggested split points.
IMHO, Megan's comment is the more completed one and should be the one marked as Best Solution and Big's and mine's comment should be marked as Assisted Solution. So my suggestion is:
I don't care about the points. Resolve it any way that is satisfactory to the others. For abandoned questions like this where I was the only respondent, I just delete them.
i dont care about the points either, however I don't necessarily believe Megans answer is the "best" one, as I think simply creating a stored procedure and putting all of the logic there is the simplist, most efficient way to work with temp tables, as they will be available to you throughout the life of the stored procedure. In all of my 15+ years working in classic asp, I've never used, or come across any reference to, sp_executesql.

Like I said, I dont care how the points are rewarded, I was just trying choose, what I thought was, the best answer.