|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Hi all,
I'm real fresh with ASP, so please bear with me. I have a trigger in SQL Server, which specifies how the records will be inserted into multiple tables. I also have an ASP page that allows the user to select a table/view/etc to insert into. In my asp code, do I exlicitely call the trigger, or do I just specify the insert statement, since the trigger is on the server already? In other wordd, can I just insert without mentioning the trigger at all in my ASP code? Thanks |
|
#2
|
||||
|
||||
|
>> In other wordd, can I just insert without mentioning the trigger at all in my ASP code?
Yes, that's how triggers work. A trigger will automatically fire off whenever the event that it is set up for occurs, so you DON'T explicitly have to call the trigger. It doesn't matter if you insert using ASP code, query analyser or whatever, the trigger will automatically work when the insert happens.
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#3
|
|||
|
|||
|
Scorpions4ever, thanks for the responce.
The reason I'm asking is that it DOESN'T do that from the ASP page, but works fine in Query Analizer. Little background: I'm using INSTEAD OF trigger to insert into multiple tables from the view. Works like a charm in QA as long as you set IDENTITY_INSERT to ON if you got identity fields in your tables. When I try to insert from asp page (I'm testing "1 Click DBPro" pre-made asp package), it comes back with: "can not inseart into multiple tables, blah blah" But the trigger is there BTW, i love Maiden, they played here 2 years ago and kicked butt. |
|
#4
|
||||
|
||||
|
>> When I try to insert from asp page (I'm testing "1 Click DBPro" pre-made asp package), it comes back with:
"can not inseart into multiple tables, blah blah" Maybe the 1 Click DBPro login doesn't have permissions to insert into the tables that your trigger is trying to work on. Are you using a different login, when you're using Query Analyser? >> BTW, i love Maiden, they played here 2 years ago and kicked butt. I'm going to see them again in Long Beach Arena, August 24th ![]() |
|
#5
|
|||
|
|||
|
>>Maybe the 1 Click DBPro login doesn't have permissions to insert into the tables that your trigger is trying to work on. Are you using a different login, when you're using Query Analyser?
Good point, I checked and I'm ok. 1 Click DBPro allows me to insert into one table at a time, but not into multiple tables. I actually don't know of any other way to insert into multiple tables other than with Instead Of trigger. If anyone out there has any ideas please let me know. |
|
#6
|
||||
|
||||
|
Use a stored procedure perhaps?
|
|
#7
|
|||
|
|||
|
you mean rap the trigger in a stored procedure?
If so, do I have to call that stored procedure from the ASP code? Or do you mean create SP for inserting values, and call it from asp code? |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > calling SQL Server trigger from ASP page |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|