do it all in one query....  I think it'll open a new connection for each
query you are sending...  the temp table is only available why the process
that creates it is running...

HTH

TOM
----- Original Message -----
From: "Justin MacCarthy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 25, 2002 2:21 PM
Subject: [ cf-dev ] Temp tables in SQL Server


> Hi,
> Anyone used temp tables in SQL Server in <cfquery>?
> Anyone see anything wrong with doing below?
>
> <cftransaction>
> <cfquery datasource="dsn" name="CreateTable">
> CREATE TABLE ##CFID#_#CFTOKEN#(WhateverID INT PRIMARY KEY)
> </cfquery>
> <cfquery datasource="dsn" name="y">
> INSERT INTO ##CFID#_#CFTOKEN#
> SELECT WhateverID
> FROM Whatever
>
> </cfquery>
> <cfquery datasource="dsn" name="x">
> SELECT  *
> FROM    Whatever2
> WHERE Whatever2.WhateverID IN
> ( SELECT  WhateverID FROM ##CFID#_#CFTOKEN#)
> </cfquery>
> <cfquery datasource="dsn" name="DropTable">
> DROP TABLE  ##CFID#_#CFTOKEN#
> </cfquery>
> </cftransaction>
>
> Cheers
> Justin
>
> --
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to