Re: Creating temp tables in MSSQL
| From: | Frank M. Kromann | Date: | Sat, 20 Dec 2003 04:29:18 +0000 |
| Subject: | Re: Creating temp tables in MSSQL | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-32140@lists.php.net to get a copy of this message | ||
Hi Matt,
Tables in tempdb are deleted when the connection is closed or when the
user deletes them with drop table #tempname.
- Frank
> Hi Frank.
>
> When does this table get deleted? when the DB connection closes or does
> one have to run a process to clear the temp tables?
>
> Thanks,
> Matt
> On Tue, 2003-12-16 at 17:29, Frank M. Kromann wrote:
>
> > Hi,
> >
> > Any table that starts with # is a temp table. You can use
> >
> > create table #mytemp (...) or you should be able to use the query you
> > suggest. You just have to make sure you have enough space in tempdb
(a
> > system database)
> >
> > - Frank
> >
> > > Hi all,
> > >
> > > I've been handed a query which I'm trying to get to work. I'm using
PHP
> >
> > > to talk to MSSQL 7.
> > >
> > > My question is this: Can I create temp tables with mssql without
> > > executing the code in a stored procedure?
> > >
> > > The simplified version of the query is as follows:
> > > $query = "SELECT distinct convert(varchar(36),traineeID)";
> > > $query.=" INTO #tempdata1";
> > > $query.=" FROM tblSignIn_trainee a";
> > >
> > >
> > > Later on I could make a stored procedure, but at the moment I would
like
> >
> > > to just work with the query directly in the code if at all
possible.
> > >
> > > Thanks,
> > > John
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
>
> Matthew Vos
> Systems Analyst
> Product Development
> Techcom Software Solutions Inc.
> 416.398.5764
> vos@techcomnet.com
>
>
> * * * * * * * * * *
> This message contains information from Techcom Software Solutions Inc.
> which is confidential and privileged. If you are not an intended
> recipient, please refrain from any disclosure, copying, distribution or
> use of this information and note that such actions are prohibited.
>
> If you have received this transmission in error, please notify
> vos@techcomnet.com.
>
> This message and any attachments have been scanned for viruses.
> This message has been digitally signed to ensure authenticity.
> Key ID: CFEA28EC
> Fingerprint: 009F E13D 0450 55AF DC1C 4D77 1FE9 0DBB CFEA 28EC
>