Posted on 2007-10-19
Medium Priority
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 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 500 total points
ID: 20112622

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

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

850 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