SCOPE_IDENTITY() not returning real column name?

2008-01-20 Thread Kay Smoljak
I have a site that uses an SQL Server database. I'm pretty sure this was working before but now it's not (shared hosting database, so I have no control over that part). Usually to return the last inserted ID, I run a select after an insert like so: cfquery datasource=#dsn# name=qry SET NOCOUNT

Re: SCOPE_IDENTITY() not returning real column name?

2008-01-20 Thread Kay Smoljak
On Jan 21, 2008 7:39 AM, s. isaac dealey [EMAIL PROTECTED] wrote: Likely what happened is they changed or updated the driver for their SQL Server databases (or possibly MDAC or some other modification to the server itself - I'm not sure offhand if MDAC is omitted with Java drivers or not) and

Re: SCOPE_IDENTITY() not returning real column name?

2008-01-20 Thread Kay Smoljak
On Jan 21, 2008 7:29 AM, Michael Traher [EMAIL PROTECTED] wrote: HI Kay, It looks to me like the select should be select scope_identity() as formatid from format i.e. the 'as' refers to the column rather than the table which is how I read your sql. Haha - all I can say is d'oh!. The reason

Re: SCOPE_IDENTITY() not returning real column name?

2008-01-20 Thread s. isaac dealey
Likely what happened is they changed or updated the driver for their SQL Server databases (or possibly MDAC or some other modification to the server itself - I'm not sure offhand if MDAC is omitted with Java drivers or not) and the new or updated driver, etc. just isn't supporting that syntax...

Re: SCOPE_IDENTITY() not returning real column name?

2008-01-20 Thread Michael Traher
HI Kay, It looks to me like the select should be select scope_identity() as formatid from format i.e. the 'as' refers to the column rather than the table which is how I read your sql. On Jan 20, 2008 10:01 PM, Kay Smoljak [EMAIL PROTECTED] wrote: I have a site that uses an SQL Server

Re: SCOPE_IDENTITY() not returning real column name?

2008-01-20 Thread s. isaac dealey
Thanks Isaac, that's interesting... I'd never really thought about how I used that code at all, I just pasted in the example from MSDN and it had the right end result so I ran with it. You're right about it returning multiple rows - that's inefficient. So it is actually returning multiples?

Re: SCOPE_IDENTITY() not returning real column name?

2008-01-20 Thread Kay Smoljak
On Jan 21, 2008 8:27 AM, s. isaac dealey [EMAIL PROTECTED] wrote: So it is actually returning multiples? And MSDN gave you that as the example... heh... that's kinda funny. It's been a little while since I worked with scope_identity() -- at my day job currently we're using mostly MS variety of

Re: SCOPE_IDENTITY() not returning real column name?

2008-01-20 Thread s. isaac dealey
Cheers for your help Isaac. Any time. :) Your description of why you use ColdFusion pretty well sums up my reasons in addition to my reasons for creating the framework. heh :) I was just updating the wikipedia article the other day because the mods had marked it as a stub and went so far as