Coldfusion 9 64bit, MSSQL 2008 R2 & GENERATED_KEYS
We recently upgraded our hosting environment to Coldfusion 9 64bit. This has caused us no end of problems, but I can't seem to find an answer to the following at all.
Take this code for example. The table is pretty basic with two colums (testID and testName) where the testID column is an auto increment primary key INT column.
<cffunction name="testInsert" returntype="query"> <cfquery datasource="#DSN_NAME#" name="testQuery"> INSERT INTO TestTable ( testName ) VALUES ( 'Test' ) SELECT SCOPE_IDENTITY() AS MyID </cfquery> <cfreturn testQuery /> </cffunction>
I would expect it to return a result set with a column called MyID; this is what our old Coldfusion 8 32bit server did with our MSSQL 2005 databases.
Since we have upgraded to Coldfusion 9 64bit and MSSQL 2008 R2, it no longer does this. Instead, it returns a query with the column called GENERATED_KEYS. It does this for pretty much everything involving a generated identity: NEWID(), SCOPE_IDENTITY() and @@IDENTITY.
You can see the result of the above query below:
This is more than painful since we host hundreds of websites which are now all broken. How do we stop this behaviour? If I alias a column I would expect it to be called that in the result set.
Thanks in advance,
Anna.
