, February 01, 2005 2:18 AM
To: CF-Talk
Subject: Re: grabbing the id of a newly created item..
That's something you should know about your DB. There are reasons to
use transactions even if your DB doesn't support them. For instance,
if you need 100% assurance that a series of statements will be
executed
Which DB are you using?
-Original Message-
From: Protoculture [mailto:[EMAIL PROTECTED]
Sent: 31 January 2005 15:10
To: CF-Talk
Subject: grabbing the id of a newly created item..
How would I modify an insert query to grab the id ( autonum, primary key
) of the item that I just
ACCESS
~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192335
Archives:
select @@identity from tableName
will return the last inserted id, assuming mssql
tw
On Mon, 31 Jan 2005 16:09:10 -, Craig Dudley [EMAIL PROTECTED] wrote:
Which DB are you using?
-Original Message-
From: Protoculture [mailto:[EMAIL PROTECTED]
Sent: 31 January 2005 15:10
To:
If you're using SQL Server, you can put the insert in a procedure, wrap
it in a transaction, and run something like this at the end:
SET @NEWID = SCOPE_IDENTITY()
This will return the most recent primary key created.
- Jim
Protoculture wrote:
How would I modify an insert query to grab the id
what about using access
~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message:
[mailto:[EMAIL PROTECTED]
Sent: 31 January 2005 15:17
To: CF-Talk
Subject: Re: grabbing the id of a newly created item..
ACCESS
~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start
Thanks Craig. Just to confirm that code..
Select For Max(ID)
~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message:
More like;
Select Max(ID) as MyNewID FROM yourtablename
-Original Message-
From: Protoculture [mailto:[EMAIL PROTECTED]
Sent: 31 January 2005 15:34
To: CF-Talk
Subject: Re: grabbing the id of a newly created item..
Thanks Craig. Just to confirm that code..
Select For Max(ID
I don't think there's a neat way of doing it for Access, I
could be wrong though.
http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=79
Couple of methods ... Could be rewritten in CF if needed
--
dc
~|
Logware
-Talk
Subject: Re: grabbing the id of a newly created item..
select @@identity from tableName
will return the last inserted id, assuming mssql
tw
On Mon, 31 Jan 2005 16:09:10 -, Craig Dudley [EMAIL PROTECTED]
wrote:
Which DB are you using?
-Original Message-
From: Protoculture
: RE: grabbing the id of a newly created item..
I don't think there's a neat way of doing it for Access, I
could be wrong though.
http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=79
Couple of methods ... Could be rewritten in CF if needed
--
dc
That is correct, I used it a few years ago when Access 2000 came out.
- Matt Small
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, January 31, 2005 12:03 PM
To: CF-Talk
Subject: RE: grabbing the id of a newly created item..
Actually IIRC this is now
Ummm...don't you mean CFTRANSACTION...and not CFLOCK??
Bryan Stevenson B.Comm.
VP Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: [EMAIL PROTECTED]
web: www.electricedgesystems.com
[EMAIL PROTECTED] wrote:
Ummm...don't you mean CFTRANSACTION...and not CFLOCK??
It should be both if using that kinda dated method.
http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_17000
That article is a golden oldie but it explains the reasons why rather well.
I personally do
:38 PM
To: CF-Talk
Subject: Re: grabbing the id of a newly created item..
Ummm...don't you mean CFTRANSACTION...and not CFLOCK??
Bryan Stevenson B.Comm.
VP Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: [EMAIL
cflock won't work across multiple servers
in a load balanced environment...
And I hope no one uses Access for that!
-Joe
--
For Tabs, Trees, and more, use the jComponents:
http://clearsoftware.net/client/jComponents.cfm
~|
Calvin Ward wrote:
In either case, cftransaction isn't guaranteed (it's only a recommendation,
and does it work with Access?)
cftransaction is not a recommendation, it sends transaction
commands to the database. What the database does with it is
something entirely different, and MySQL is the
In either case, cftransaction isn't guaranteed (it's only a
recommendation, and does it work with Access?) ...
I don't think this is correct. When you specify BEGIN TRANSACTION within an
SQL batch (which is the raw SQL equivalent of the CFTRANSACTION tag), it
isn't a recommendation, but rather
What the database does with it is
something entirely different, and MySQL is the usual suspect if
something blows up, not Access.
What do you mean, Jochem? Aside from some quirks with temporary
tables and ALTER TABLE statements in 4.0, I've not run into issues
with MySQL's transaction
Barney Boisvert wrote:
What the database does with it is
something entirely different, and MySQL is the usual suspect if
something blows up, not Access.
What do you mean, Jochem? Aside from some quirks with temporary
tables and ALTER TABLE statements in 4.0, I've not run into issues
with
MyISAM tables don't support transactions. Or are you saying if you
use CFTRANSACTION on MyISAM tables, it blows up? I've never seen that
behaviour either, though I don't know if I've tried it with CFMX, only
BD (because BD doesn't do the single threading of requests to
connections thing).
Barney Boisvert wrote:
MyISAM tables don't support transactions.
Exactly. But if you try to use a cftransaction on them, no error
is thrown. So you only find out much later that rollbacks didn't
work etc.
Jochem
~|
Logware
So how would I use the code below in context of an insert statement?
select @@identity from tableName
~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours
Me either, but one can never be sure!
-Original Message-
From: Joe Rinehart [mailto:[EMAIL PROTECTED]
Sent: Monday, January 31, 2005 2:33 PM
To: CF-Talk
Subject: Re: grabbing the id of a newly created item..
cflock won't work across multiple servers
in a load balanced environment
Sorry, got my wires crossed on that one.
I still prefer the UUID approach (or use a stored procedure - not available
in Access).
- Calvin
-Original Message-
From: Dave Watts [mailto:[EMAIL PROTECTED]
Sent: Monday, January 31, 2005 3:00 PM
To: CF-Talk
Subject: RE: grabbing the id
Does Access let you do multiple statements in a single CFQUERY tag
like SQL Server? Not a stored proc, but close, because they'll run in
the same connection. Should be sufficient for this scenario
cheers,
barneyb.
On Mon, 31 Jan 2005 15:41:10 -0500, Calvin Ward [EMAIL PROTECTED] wrote:
That's something you should know about your DB. There are reasons to
use transactions even if your DB doesn't support them. For instance,
if you need 100% assurance that a series of statements will be
executed on a single connection, and no other statements will be
interspersed between them. If
28 matches
Mail list logo