Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

New to XML....??? Expand / Collapse
Author
Message
Posted Tuesday, April 30, 2013 7:35 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 2:00 PM
Points: 295, Visits: 488
Hi,

I',m new to XML and here is what I need to do...

I want to create a SQL query to pull data and update a field on a table with current date and another field an "X"
I need the data in the select to be written to an XML.
I then need the XML file emailed,
Once emailed I need to run another query to update the 'X" to 'Y' showing its been sent...

I assume I can do this from some job steps?
I really don't know where to start??


Thanks
Joe
Post #1448028
Posted Wednesday, May 1, 2013 9:04 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 3:21 PM
Points: 1,210, Visits: 2,512
jbalbo (4/30/2013)
Hi,

I',m new to XML and here is what I need to do...

I want to create a SQL query to pull data and update a field on a table with current date and another field an "X"
I need the data in the select to be written to an XML.
I then need the XML file emailed,
Once emailed I need to run another query to update the 'X" to 'Y' showing its been sent...

I assume I can do this from some job steps?
I really don't know where to start??


Thanks
Joe


Sounds like you could use the sp_send_dbmail stored procedure with the @query parameter and the FOR XML clause to extract the data you want to send. Your UPDATE statements will have to be separate, but you can use transaction control and TRY-CATCH error handling to maintain the integrity and consistency of the data (e.g., rolling back the UPDATE statements if the sp_send_dbmail proc fails).

Look into those concepts, and if you have questions about how to implement them, please post back.


Jason Wolfkill
Blog: SQLSouth
Twitter: @SQLSouth
Post #1448457
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse