Thanks, and insteresting of  maxrows=-1 
Why -1 ?
 
 
-----Original Message-----
From: Joseph Flanigan [mailto:[EMAIL PROTECTED]
Sent: Monday, June 13, 2005 9:26 AM
To: [email protected]
Subject: RE: [CFCDev] Application Data Source Names

Here is an example of how to put 2 queries in a single cfquery for SQL Server.

The tContact table has a primary key, ContactID, that is of type identity.

<cffunction name="Create" returntype="query">
     <cfargument name="theParams" type="struct" default="#this#" required="yes" >
     <cfargument name="DSN" type="string" default="#this.DSN#">
      <cfset var qtContact_INS = "" >

     <cfquery name="qtContact_INS" datasource="#Arguments.DSN#" maxrows=-1 >
          BEGIN TRANSACTION
          INSERT INTO dbo.tContact             
               (
               [ContactTypesID],
               [StatusID],
               [TimeZoneID]
               )
               VALUES
               (
               <cfqueryparam value="#theParams.$ContactTypesID#" cfsqltype="CF_SQL_smallint" >,
               <cfqueryparam value="#theParams.$StatusID#" cfsqltype="CF_SQL_smallint" >,
               <cfqueryparam value="#theParams.$TimeZoneID#" cfsqltype="CF_SQL_smallint" >
               )
              
          SELECT  [ContactID]
          FROM dbo.tContact
          WHERE ContactID = SCOPE_IDENTITY()
          COMMIT TRAN
     </cfquery>
<cfreturn qtContact_INS >
</cffunction>

(Reference: This code is exactly what CFSQLTool generates.)

Joseph

-----------------------------------------------------------------------
http://www.switch-box.org/CFSQLTool/Download/

Switch_box                        MediaFirm, Inc.
www.Switch-box.org               Loveland, CO  USA
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to