[SOLVED] Generate MERGE script

Feature requests and their debate

[SOLVED] Generate MERGE script

Postby maslopo » Tue Feb 12, 2013 12:07 pm

I apologize if I go back and insist on the issue of automatic generation script on a MERGE table,
for me is very useful in the design of datawarehouse ETL (for the Slowly changing dimensions) ...
create temporary tables containing the record to update or insert and through the construct sql MERGE (Vertica, Oracle , MSServer) I update the fact table without making any effort ... The automatic generation would help me in the frequent case of tables with a large number of fields.

See http://www.sqlservercentral.com/articles/MERGE/73805/
for detail

ES:

table_tmp and target_table has same structure, often target_table has a unique index or pk from wich
create the ON clause...

MERGE INTO target_table AS Target
USING table_tmp AS Source
ON ( Target.key_field = Source.key_field )
WHEN MATCHED
THEN UPDATE SET
data= target.data , data2=target.data2
WHEN NOT MATCHED
THEN INSERT ( key_field,dat,data2)
VALUES
( target.key_field,target.dat,target.data2 );
Last edited by maslopo on Tue Feb 19, 2013 9:30 am, edited 1 time in total.
maslopo
 
Posts: 25
Joined: Fri Dec 28, 2012 4:17 pm

Re: Generate MERGE script

Postby Serge » Tue Feb 12, 2013 2:07 pm

Ok, I think its quite easy task. Probably next version will include this feature.
Serge
 
Posts: 1526
Joined: Sat Feb 26, 2011 8:24 pm
Location: SPb


Return to Feature Requests



Who is online

Users browsing this forum: Google [Bot] and 11 guests