Is their best to to execute update query. here is my problem
I have a two table on different databases on sql server 2000...
one called source which has 104 fields and another called des table with
same fields...
i want to check if any thing changed in source update the destination....
now i create a sql string mean uinsg dynamic sql to create where clause cos
if write a query my self it will take ages to write that where clause cos i
am comparing each field with each field using OR statment... then i cannt d
o
it with update so i delete the records from des table and insert again from
source table.... as writing update query need too mush string and also will
be problem to put where clause ....
is what i am doing is ok or any other better idea to overcome that problem
thanksHi,
You may use COLUMNS_UPDATED() function in the trigger to find out the
updated columns. But still you have the difficulty of transferring the
changes to dest table. Probably dynamically creating the update command can
help. If you want to get rid of writing any code, replication is an option!
"amjad" <amjad@.discussions.microsoft.com> wrote in message
news:8A6199E7-8F13-4BC3-BBAE-9DC56D699EE6@.microsoft.com...
> Is their best to to execute update query. here is my problem
> I have a two table on different databases on sql server 2000...
> one called source which has 104 fields and another called des table with
> same fields...
> i want to check if any thing changed in source update the destination....
> now i create a sql string mean uinsg dynamic sql to create where clause
> cos
> if write a query my self it will take ages to write that where clause cos
> i
> am comparing each field with each field using OR statment... then i cannt
> do
> it with update so i delete the records from des table and insert again
> from
> source table.... as writing update query need too mush string and also
> will
> be problem to put where clause ....
> is what i am doing is ok or any other better idea to overcome that problem
> thanks|||It would probably take less time to manually write out all 104 columns than
the time you have spent messing with the dynamic SQL. Maybe a few minutes
in any decent text editor?
"amjad" <amjad@.discussions.microsoft.com> wrote in message
news:8A6199E7-8F13-4BC3-BBAE-9DC56D699EE6@.microsoft.com...
> Is their best to to execute update query. here is my problem
> I have a two table on different databases on sql server 2000...
> one called source which has 104 fields and another called des table with
> same fields...
> i want to check if any thing changed in source update the destination....
> now i create a sql string mean uinsg dynamic sql to create where clause
cos
> if write a query my self it will take ages to write that where clause cos
i
> am comparing each field with each field using OR statment... then i cannt
do
> it with update so i delete the records from des table and insert again
from
> source table.... as writing update query need too mush string and also
will
> be problem to put where clause ....
> is what i am doing is ok or any other better idea to overcome that problem
> thanks
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment