Wednesday, March 28, 2012

How can I read/create a file from t-sql?

I need to create/read files from t-sql? Does anyone know how can I do it?
Thanksbcp?

bulk insert?

DTS?

You probably mean as device the you read sequentially through...

Nope, and you wouldn't want to.|||Thanks Brett. I know the tools you suggested me, but I think they cant help me so much.

What I need to do is process the information. The scenario is: I have two dbs one exporting data, A, and the other, B, importing them, communication is not assured, and moreover, depending on the incoming data and data on B db, I should update records on B or insert them, so, I think, I cant use bcp or bulk insert.

I have been working with oracle and pl-sql has system defined functions and procedures to access files from stored functions or procedures. I have look for the equivalent functions/procedures on T-sql and I havent found any information, dont they exist?

If they dont exist I want to know if I can program DTS task to read data from files and process them.

Thanks in advance|||You basically want to do delta processing right?

If it's in A and not in B, add to b
If it's in A and in B, update B
If it's not in A and in B delete B..

something like that?

I would just compare the tables...

have a look

Delta Process (http://weblogs.sqlteam.com/brettk/archive/2004/04/23/1281.aspx)

No comments:

Post a Comment