> A bit new to all this..
>
> Can you check to see if a table exists within a database with
> cold fusion?
> If so can someone tell me how please.
>
> The reason for this, is one part of my database copies a
> table into another which is name uniquley by a the users
> id, however this table needs to be deleted once the user
> has logged off, problem being if the user does not log
> off correctly the table will still be there, so I need to
> be check for existence and delete at the logon stage.

Which database engine are you using?

If you're using SQL Server;
Select table_name
>From information_schema.tables
Where table_name='myTable'

If you're not using SQL Server, and something like Access, then you'll
have to do it in a CFTRY/CFCATCH

I know there's a real way to do it in Oracle, but I don't know what it
is

<cfset TableExists="No">
<cftry>
        <cfquery datasource="myDSN" name="test">
                select top 1 *
                from myTable
        </cfquery>
        <cfset TableExists="Yes">
        <cfcatch>
        </cfcatch>
</cftry>

Philip Arnold
Technical Director
Certified ColdFusion Developer
ASP Multimedia Limited
Switchboard: +44 (0)20 8680 8099
Fax: +44 (0)20 8686 7911

www.aspmedia.co.uk
www.aspevents.net

An ISO9001 registered company.

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************


______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to