it wont work for the local #tables.
you should have to use the like '#tables%'
-----Original Message-----
From: Horton, Joe (LNI) [mailto:[Email Address Removed] Tuesday, March 23, 2004 6:16 AM
To: LazyDBA.com Discussion
Subject: RE: #temp table object_id
Thanks - this was what I needed...lost myself migrating from Sybase!
__________________________
Joe Horton
Database Developer / Software Engineer
WISHA/Legal Services Software Development
Department of Labor and Industries
Voice (360) 902-5928 fax (360) 902-6200
-----Original Message-----
From: Duhn, Brian [mailto:Brian.[Email Address Removed]
Sent: Monday, March 22, 2004 4:40 PM
To: LazyDBA.com Discussion
Subject: RE: #temp table object_id
One step further and you're there:
CREATE TABLE #text (text_key VARCHAR (255), text_string TEXT NULL)
Select OBJECT_ID('tempdb..#text')
-----Original Message-----
From: dli [mailto:[Email Address Removed]
Sent: Monday, March 22, 2004 6:45 PM
To: LazyDBA.com Discussion
Subject: Re: #temp table object_id
CREATE TABLE #text (text_key VARCHAR (255), text_string TEXT NULL)
Select OBJECT_ID('#text')
Horton, Joe (LNI) writes:
> How come when I create a temp table as below, It does not show up in my
> OBJECT_ID? What I really need to do is test for the existence of a given
> temp table and drop it if it exists or create it if it doesn't.
>
> CREATE TABLE #text (text_key VARCHAR (255), text_string TEXT NULL)
> Select OBJECT_ID('#MyTempTable')
>
> RETURNS:
> NULL
>
> __________________________
> Joe Horton
> Database Developer / Software Engineer
> WISHA/Legal Services Software Development
> Department of Labor and Industries
> Voice (360) 902-5928 fax (360) 902-6200
>
Darwin Li
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Get today's cartoon: http://www.LazyDBA.com
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] email may contain confidential material.
If you were not an intended recipient,
Please notify the sender and delete all copies.
We may monitor email to and from our network.
****************************************************************************
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Get today's cartoon: http://www.LazyDBA.com
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Get today's cartoon: http://www.LazyDBA.com
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page