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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Comparing the Column Values while Inserting Data

Author  Topic 

avmreddy17
Posting Yak Master

180 Posts

Posted - 2006-12-08 : 08:21:48
Need some suggesttions.

I have a table

CREATE TABLE Symbols
(
Symbol VARCHAR(16),
TradeDate DATETIME ,
ProcessIndicator CHAR(1) ,
Col1 VARCHAR(10) ,
Col2 VARCHAR(10)
.
.
So on
)

Here Col1 and Col2....Coln are all the other columns ( Say Symbol Properties )

Ex

Here is my Question , I have to create a Delta File on a daily basis and send it out. Say First time when I load the table , we have 2000 symbols for the TradeDate 12/07/2006 and I create the file for these 2000 symbols and send it out. Next day 1e on 12/08/2006 I have a total of 2500 symbols out of which we have 500 New Sysbols whch we just append to the existing table. For the Rest of the 2000 sybols I have to compare the values of each Columns and if there is a Diff then I have to send the 500 New Symbols and the Symbols where the properties have changed.

#. What is the best way to compare the columns for already existing symbols
#. What is the best way to mark the lines which are modified.

Any Sugestions as to how to approach this.

Thx Much
V





nr
SQLTeam MVY

12543 Posts

Posted - 2006-12-10 : 21:03:15
Can you put a changed date on the table or have another tables for the id's that have changed and use that for the extract?
You could maintain this when you update the table or via a trigger.

Otherwise you will have to keep another table of rows that were extracted and do a column by column compare.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -