Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
scorchpc
Starting Member
3 Posts |
Posted - 2009-11-23 : 13:30:40
|
Hi All,I am new here. I've been needing to find a good SQL forum I can be a part of so I decided to join this one today. I did so because I am having to do more and more SQL work in my job.Anyway. Here is what we need to be able to do.Every time a part is logged out of our system, we need to output a flat file, which the customer's system will then import and use.I am thinking a trigger would be the best way, but I am open to other ideas. Also, I'm not sure how to make a trigger output to a flat file.Any help you can give is appreciated.Thanks,James |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-11-23 : 13:44:59
|
you can do this inside trigger using bcp using xp_cmdshell or bulk insert. but i prefer doing this via sql job which does this task periodically based on a control table. |
|
|
scorchpc
Starting Member
3 Posts |
Posted - 2009-11-23 : 13:56:54
|
thanks visakh16The reason I am picking a trigger instead of a job is because this needs to happen near real time.Example; Part is logged out of our system as a Pass or Fail. Then the same part is logged out of the customers system, via the same person and PC.I'm not sure how to make the trigger use a command shell and BCP to output to a file. The file format is:Format:SN=sernumberStatus=[Success|Fail errorcode1 errorcode2]Examples:SN=exampleSN1Status=SuccessSN=exampleSN2Status=Fail BD040 |
|
|
scorchpc
Starting Member
3 Posts |
Posted - 2009-11-23 : 17:21:38
|
I still have so much to learn. I can make a DTS package to output the data to text, but I need the serial and status on separate lines, which "SN" and "STATUS" in front of them. I've been playing around but having a bit of trouble. |
|
|
|
|
|