een the two requests waiting...
- Calvin
-Original Message-
From: Ewok [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 01, 2005 11:04 AM
To: CF-Talk
Subject: RE: EASY: grabbing the id of a newly created item..
> It absolutely isn't your only option. And if you do the below you need
Robertson-Ravo, Neil (RX) wrote:
> We tend to avoid them since we use SP's for all our SQL anyway. We find it
> easier to manage. Personally I don't like triggers - I think they are evil.
Triggers that don't change data but just throw errors when the
data is invalid are great. Triggers that chan
Agreed!!! ;-)
Jeff
- Original Message -
From: "Robertson-Ravo, Neil (RX)" <[EMAIL PROTECTED]>
To: "CF-Talk"
Sent: Tuesday, February 01, 2005 9:12 AM
Subject: RE: EASY: grabbing the id of a newly created item..
> We tend to avoid them since we use SP'
> We tend to avoid them since we use SP's for all our SQL
> anyway. We find it easier to manage. Personally I don't like
> triggers - I think they are evil.
If you can constrain database access to only allow SPs, that's fine. If you
can't, triggers are extremely useful. For web applications, wh
rom: "Robertson-Ravo, Neil (RX)" <[EMAIL PROTECTED]>
To: "CF-Talk"
Sent: Tuesday, February 01, 2005 8:50 AM
Subject: RE: EASY: grabbing the id of a newly created item..
> Best to avoid triggers full stop.
>
> -Original Message-
> From: Jeff Garza [ma
> What's "right" for one application is quite possibly overkill
> for another. Did I mention it was access?
>
> **ducks**
>
Yeah the database is Access at the moment. And the application at the
moment is using access... But it might get upgraded... The same
priniciple might be used in another
t; <[EMAIL PROTECTED]>
To: "CF-Talk"
Sent: Tuesday, February 01, 2005 8:50 AM
Subject: RE: EASY: grabbing the id of a newly created item..
> Best to avoid triggers full stop.
>
> -Original Message-
> From: Jeff Garza [mailto:[EMAIL PROTECTED]
> Sent: 01 Fe
Best to avoid triggers full stop.
-Original Message-
From: Jeff Garza [mailto:[EMAIL PROTECTED]
Sent: 01 February 2005 15:41
To: CF-Talk
Subject: Re: EASY: grabbing the id of a newly created item..
If you are using SQL Server 2000, I would recommend moving away from using
@@IDENTITY as
ll always be the correct ID.
- Calvin
-Original Message-
From: Ewok [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 01, 2005 10:01 AM
To: CF-Talk
Subject: RE: EASY: grabbing the id of a newly created item..
Wow, too much for so little, Just use Richard's method
RUN YOUR INSERT QUERY
Th
ay, February 01, 2005 10:13 AM
To: CF-Talk
Subject: RE: EASY: grabbing the id of a newly created item..
> Wow, too much for so little, Just use Richard's method
>
> RUN YOUR INSERT QUERY
>
> Then directly after the insert get the records ID...
>
>
> SELECT MAX(The
Best to avoid triggers full stop.
-Original Message-
From: Jeff Garza [mailto:[EMAIL PROTECTED]
Sent: 01 February 2005 15:41
To: CF-Talk
Subject: Re: EASY: grabbing the id of a newly created item..
If you are using SQL Server 2000, I would recommend moving away from using
@@IDENTITY as
rtson-Ravo, Neil (RX)" <[EMAIL PROTECTED]>
To: "CF-Talk"
Sent: Tuesday, February 01, 2005 8:20 AM
Subject: RE: EASY: grabbing the id of a newly created item..
> SQL Server is simply @@IDENTITY
>
>
>
> -Original Message-
> From: Ewok [mailto:[EMAIL PROTEC
SQL Server is simply @@IDENTITY
-Original Message-
From: Ewok [mailto:[EMAIL PROTECTED]
Sent: 01 February 2005 15:01
To: CF-Talk
Subject: RE: EASY: grabbing the id of a newly created item..
Wow, too much for so little, Just use Richard's method
RUN YOUR INSERT QUERY
Then dir
> Wow, too much for so little, Just use Richard's method
>
> RUN YOUR INSERT QUERY
>
> Then directly after the insert get the records ID...
>
>
> SELECT MAX(TheID) as LatestID FROM TABLENAME
>
Sorry but have to chime in here rather than lurking
OK it'll work, but what happens if you hav
ct ID.
- Calvin
-Original Message-
From: Ewok [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 01, 2005 10:01 AM
To: CF-Talk
Subject: RE: EASY: grabbing the id of a newly created item..
Wow, too much for so little, Just use Richard's method
RUN YOUR INSERT QUERY
Then directly
source. For the most part, access locks itself when it needs
to.
-Original Message-
From: Barney Boisvert [mailto:[EMAIL PROTECTED]
Sent: Monday, January 31, 2005 2:02 PM
To: CF-Talk
Subject: Re: EASY: grabbing the id of a newly created item..
That's a horrible way to do it. Qui
CTED]
Sent: Tuesday, 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
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
I always use the ident_current('tablename') function in SQLServer2000,
but then again I'm not likely to change that in the forseeable future.
But another way to do it, that would be independent of database would
be to select based on the criteria you just inserted such as:
INSERT into tablename
> > > That's only reliable inside a transaction. Don't leave that
> > > part out.
> >
> > Actually, depending on your database, a transaction may not
> > be required just as Barney states. For example, if you're
> > using MS Access, the entire table is locked when you write
> > to it, so a tra
Dave Watts wrote:
>>
>>That's only reliable inside a transaction. Don't leave that
>>part out.
>
>
> Actually, depending on your database, a transaction may not be required just
> as Barney states. For example, if you're using MS Access, the entire table
> is locked when you write to it, so a tr
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:
> Sor
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 of a
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
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 s
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 (
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).
cheers
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 issue
> > That's a horrible way to do it. Quite inefficient.
> >
> > A better route is to check your DB's docs and see how they
> > expose the last inserted sequence value. In MySQL it's
> > LAST_INSERT_ID(), with MS SQL Server its one of three
> > @IDENTITY variables. Run your INSERT, and then sele
> 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 capab
> 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 rathe
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
> 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
~|
uary 31, 2005 1: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
> That's only reliable inside a transaction. Don't leave that part out.
AND a named lock to choke the process down to a single user. Adding
in all of that overhead makes for a serious potential bottleneck in
performance, imho, so I never do it. If you can optimize for a single
db platform then
12:08 PM
Subject: Re: EASY: grabbing the id of a newly created item..
> Barney Boisvert wrote:
>> That's a horrible way to do it. Quite inefficient.
>>
>> A better route is to check your DB's docs and see how they expose the
>> last inserted sequence value
Not necessarily. One of the SQL Server variables is a global
variable, so you can call it anytime for the last ID, with no
knowledge of who inserted it or even what table. If that's what you
care about, then a transaction is irrelevant. WIth MySQL's
LAST_INSERT_ID() it's tracked by connection (n
tables. In a shared environment I'd use
"myname_databasename_tablename".
- Original Message -
From: "Barney Boisvert" <[EMAIL PROTECTED]>
To: "CF-Talk"
Sent: Monday, January 31, 2005 12:01 PM
Subject: Re: EASY: grabbing the id of a newly created
Barney Boisvert wrote:
> That's a horrible way to do it. Quite inefficient.
>
> A better route is to check your DB's docs and see how they expose the
> last inserted sequence value. In MySQL it's LAST_INSERT_ID(), with MS
> SQL Server its one of three @IDENTITY variables. Run your INSERT, and
>
That's a horrible way to do it. Quite inefficient.
A better route is to check your DB's docs and see how they expose the
last inserted sequence value. In MySQL it's LAST_INSERT_ID(), with MS
SQL Server its one of three @IDENTITY variables. Run your INSERT, and
then select the value back out usi
<[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
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
~
-Original Message-
From: Protoculture [mailto:[EMAIL PROTECTED]
Sent: Monday, January 31, 2005 7:10 AM
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 inserted
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
> To: CF-Talk
> Subject: 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 me
-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 Mess
> 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 (www.logware
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
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: http://www.
otoculture [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
applicat
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: http://www.houseoffusion.com/lists.cfm/link=i:4:1
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
t: 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 inserted?
>
>
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:
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 inserted
How would I modify an insert query to grab the id ( autonum, primary key ) of
the item that I just inserted?
~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/b
56 matches
Mail list logo