I'd recommend against using a trigger for this... I have seen it done,
but I've never seen documentation anywhere that explains it being
supported... An insert statement as a rule of thumb is not intended to
return anything, just to perform the insert and get out of there.
Stored procedures are the db structure intended to provide the kind of
"insert and some other stuff" functionality that's accomplished this
way. Also this select statement may potentially cause some issues with
insert statements of the kind "insert into mytable (x,y,z) select
x,y,z from myothertable".
> On 7/20/05, Bert Dawson <[EMAIL PROTECTED]> wrote:
>> Years ago i picked up a way of returning the value
>> inserted into an
>> Identity column in SQL server, by adding a trigger to
>> that table:
>>
>> CREATE TRIGGER get_my_id ON dbo.my_table
>> FOR INSERT
>> AS
>> SELECT my_id AS my_new_id
>> FROM INSERTED
>> GO
>>
>> Then i can run:
>>
>> <cfquery name="q_test" datasource="#dsn#">
>> INSERT INTO my_table (my_text)
>> VALUES ('foo')
>> </cfquery>
>>
>> my new id = #q_test.my_new_id#
s. isaac dealey 954.522.6080
new epoch : isn't it time for a change?
add features without fixtures with
the onTap open source framework
http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:219163
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54