Posted on 2007-10-19
Last Modified: 2010-03-20
I have a line in a stored procedure (MSSQL2000):
IF EXISTS (SELECT * FROM sysobjects WHERE ID = OBJECT_ID('#UMServiceTypeAmount')) DROP TABLE #UMServiceTypeAmount

I am going through the stored procedure line by line to learn what it does. From what I understand it creates a temp table in tempDB. I created a Query and this line does not work running under a particular database (not tempdb but test).  I guess I was just wondering why it doesn't run in the query and how to make it work in the query window?


Question by:Rayzback
    1 Comment
    LVL 142

    Accepted Solution


    IF EXISTS (SELECT * FROM sysobjects WHERE ID = OBJECT_ID('tempdb..#UMServiceTypeAmount')) DROP TABLE #UMServiceTypeAmount

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
    Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now