calling procedure within trigger
-
i have insert trigger its function is insert one column in a table and stored procedure its function to insert data to remained columns in the same table . can i call the procedure within the trigger to perform row task completely or change my scenario regards
-
i have insert trigger its function is insert one column in a table and stored procedure its function to insert data to remained columns in the same table . can i call the procedure within the trigger to perform row task completely or change my scenario regards
-
Why not try it and see? Its quicker than posting a message and waiting for a reply :)
Bob Ashfield Consultants Ltd
trigger text: Create trigger dbo.invoiceNum on invoice_summary fro insert as begin insert into invoice_details(invoice_num) select invoice_num from inserted exec insertInvoiceDetails /*stored procedure to insert to remained columns in invoice_details table */ end GO when trigger fired it insert the Invoice_num but when stored procedure fired it tries to insert new row and didn`t find invoice_num (Not Null column) then raised error thar Invoice_num don`t allow nulls regards
-
trigger text: Create trigger dbo.invoiceNum on invoice_summary fro insert as begin insert into invoice_details(invoice_num) select invoice_num from inserted exec insertInvoiceDetails /*stored procedure to insert to remained columns in invoice_details table */ end GO when trigger fired it insert the Invoice_num but when stored procedure fired it tries to insert new row and didn`t find invoice_num (Not Null column) then raised error thar Invoice_num don`t allow nulls regards
So does your stored proc work outside the trigger, even with no parameters? You really need to try and cure these problems yourself, you get no benefit from other people telling you what is wrong - how do you think we find out these things?
Bob Ashfield Consultants Ltd
-
i have insert trigger its function is insert one column in a table and stored procedure its function to insert data to remained columns in the same table . can i call the procedure within the trigger to perform row task completely or change my scenario regards
yes you can,.. trigger is a plsql block and u can call procs / funcs in it.