Solved

Service and database table

Posted on 2009-04-03
4
133 Views
Last Modified: 2012-05-06
I have a sql server 2005 database and I want to keep track of 1 table with 3 fields (Number, Name, Status) in it. For example is a record is inserted into this table with a status of 1 then I want to generate a xml based on the information for that record in the table. If the status is other than 1 I do not need to worry about it. I have heard I would probably need to develop a vb service to do this, any thoughts or suggestions would be very helpful. Also any ideas requireing code would have to be in vb.net 2005. Again I thank you for any help offered in advance.
0
Comment
Question by:lothos123452000
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:CraigYellick
ID: 24065544
A trigger will handle the part about "when a record is inserted". The FOR XML clause will handle the creation of an XML document based on the inserted record. Neither of these require a service.

What do you want to do with the XML document once it is created? That might require a service but more likely a CLR procedure with appropriate permissions can do just about anything.
0
 

Author Comment

by:lothos123452000
ID: 24069151
Once the xml is created I need to post it, using https: to a third party who is initially inserting the record to let them know it was inserted successfully. Perhaps your right a CLR would do the trick, but would I just create a job on the sql server to run the clr every minute or did you have something else in mind.
0
 
LVL 11

Accepted Solution

by:
CraigYellick earned 500 total points
ID: 24069339
Depends how often this event will happen. A CLR trigger procedure could do the whole thing, but could be a problem if there are many inserts and the targer HTTPS server responds slowly or is down.  For the long term you are right, it would be best to batch this up with a process that can handle a large number of inserts and be separate from sending the acknowledgement.

Rather than reacting to the insert you could have a flag in the table that defaults to indicating the need to be processed. When the SQL job runs it looks for the flag and processes records.  You could still use a CLR procedure to keep this all inside SQL Server and not be dependent on outside services. If you ever move the database to another server it will move along with it.

0
 

Author Closing Comment

by:lothos123452000
ID: 31566455
Thanks for the suggestions and the help I appreciate it.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Creating and Managing Databases with phpMyAdmin in cPanel.
Read about achieving the basic levels of HRIS security in the workplace.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now