I've a few questions :
- How can I create a trigger ?
I go the SQL server. Databases - productiondatabase name - tables - dbo.Orders - on folder 'Trigger' right click - select 'New trigger'. But when I save the SQL code I get a pop-up to save the code in *.sql. So I have to give a name. When I do that I don't see the filename under folder 'Trigger'. I mean I thought that I see the filename here. What do I wrong ?
2. Users get a warning ?
I was busy with the trigger on the production data because I thought I can't do anything wrong but suddenly the users call me they get an error. They were working on the ERP system and enter orders. Do I need to take action or what do I have to do the users don't get this message ?
3. Sent a mail
On internet I wrote that you have to configure your database if you want to sent a mail. It's a complicated configuration.
But I also found this code.
CREATE TRIGGER reminder2
AFTER INSERT, UPDATE, DELETE
@profile_name = 'AdventureWorks2012 Administrator',
@recipients = 'danw@Adventure-Works.com',
@body = 'Don''t forget to print a report for the sales force.',
@subject = 'Reminder';
Is this also a correct code ?
4. Table dbo.orders_email
In your code I see, I think, table dbo.orders_email. I think I have to create this table manually with the fields PK, create_date and status. Or I'm wrong ?
If I have problems to sent the mail or there other options ? Put a file in a certain folder or ......?
And I want to thank you for the code.