David
Tue Sep 18 13:43:40 PDT 2007
"Linn Kubler" <lkubler@chartwellwisc2.com> wrote in message
news:OqRB4df%23HHA.1484@TK2MSFTNGP06.phx.gbl...
> Hi David,
>
> I'm not sure they actually use transactions in this database application
> so I'm not sure I need to worry about roll backs. I don't have access to
> the source code, it's a purchased application. I actually thought this is
> what triggers were designed for, a state change in a record causes a
> trigger to fire running another process.
>
> I'm not familiar with SQL Reporting Services I'll have to look that up.
> Is it a purchased product or built into SQL? What I'm looking for is a
> sollution that doesn't require user intervention.
>
If it's a third party app then triggers may be the way to go. Triggers are
fine for DML operations but not for invoking external code because a trigger
runs in an implicit transaction. What I would do is to use a trigger to
insert the updated rows to another table (example below). Then create a SQL
Agent job that periodically polls the print queue table looking for new
data, calls the report program if necessary and then removes the data after
printing.
CREATE TRIGGER trg1 ON dbo.YourTable FOR INSERT AS
IF @@ROWCOUNT >0
INSERT INTO dbo.PrinterQueue (col1, col2, col3)
SELECT col1, col2, col3
FROM inserted;
GO
As with any change there is always a possibility that the application code
could be affected. Test carefully.
Reporting Services is a solution for creating and publishing reports and
it's included with SQL Server.
http://www.microsoft.com/sql/technologies/reporting/default.mspx
--
David Portas