• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

SQL question

LEGEND ,
May 16, 2006 May 16, 2006

Copy link to clipboard

Copied

<cfquery name="cartID" datasource="#client.dsn#"
username="#client.username#" password="#client.password#">

insert into CART_ID (email, date_stamp) values ('#client.Admin#',
'#DateFormat(CreateODBCDateTime(now()), "yyyy/mm/dd")#')
</cfquery>

There is an identity field in my CART_ID table that is a auto incremented
identity field.

With the following sql statement above is there a way to determine the
identity field value that the records are put into without creating a whole
new select query?


TOPICS
Advanced techniques

Views

258

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 16, 2006 May 16, 2006

Copy link to clipboard

Copied

After some searching i found an answer that works

<cfquery name="cartID" datasource="#client.dsn#"
username="#client.username#" password="#client.password#">
insert into CART_ID (email, date_stamp) values ('#client.Admin#',
'#DateFormat(CreateODBCDateTime(now()), "yyyy/mm/dd")#')
select SCOPE_IDENTITY() as value</cfquery>


"bj" <orders@seton.net.au> wrote in message
news:e4e3r7$j1h$1@forums.macromedia.com...
> <cfquery name="cartID" datasource="#client.dsn#"
> username="#client.username#" password="#client.password#">
>
> insert into CART_ID (email, date_stamp) values ('#client.Admin#',
> '#DateFormat(CreateODBCDateTime(now()), "yyyy/mm/dd")#')
> </cfquery>
>
> There is an identity field in my CART_ID table that is a auto incremented
> identity field.
>
> With the following sql statement above is there a way to determine the
> identity field value that the records are put into without creating a
> whole new select query?
>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 16, 2006 May 16, 2006

Copy link to clipboard

Copied

LATEST
I would suggest removing the dateformat function and just pass the createodbcdatetime result

Ken

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation