Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Why does this sp work on one server but not another?

Why does this sp work on one server but not another?

Why does this sp work on one server but not another?

I have the following stored procedure running fine on a SQL Server 6.50.416 machine.

if exists (select * from sysobjects where id = object_id('dbo.sp_search_person') and sysstat & 0xf = 4)
drop procedure dbo.sp_search_person

/****** Object: Stored Procedure dbo.sp_search_person Script Date: 9/14/99 9:14:50 PM ******/
CREATE PROCEDURE sp_search_person AS

select * from person p, #searchtemp st where p.person_id = st.person_id


I need to get it on another machine running the same build of SQL Server. When I try to transfer to or recreate it on the other server, I get the error:
Error 208: [SQL Server] Invalid object name "#searchtemp"

What could be different about the servers that one would like it and the other would not?

RE: Why does this sp work on one server but not another?

Where does your temporary table #searchtemp get created? There may be another stored procedure that has to run first.

RE: Why does this sp work on one server but not another?

All the message is telling you is that the temp
table #searchtemp has not been created on the second
You need to find the DDL for it on the first sever
and run it on the second server.
Your procedure should compile fine after that.
Also you might want to change you procedure to something
IF OBJECT_ID('dbo.sp_search_person') IS NOT NULL
DROP PROCEDURE dbo.sp_search_person

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close