-- Create Target Table
CREATE TABLE dbo.Sales (Id int,
SalesAmount money);
INSERT INTO dbo.Sales VALUES(1,10.99);
-- Create Source Table
CREATE TABLE dbo.NewSalesNAdjustments(Id int,
SalesAmount money);
INSERT INTO dbo.NewSalesNAdjustments VALUES (1, 12.99);
INSERT INTO dbo.NewSalesNAdjustments VALUES (2, 5.99);
go
merge sales t ---target
using newsalesNAdjustments as S ---Source
on t.id=s.id
when matched then ---update
update set t.salesamount=s.salesamount
when not matched then ---insert
insert (id,salesamount) values(s.id,s.salesamount);
---verify upsert operation
select * from sales
go
merge sales t
using NewsalesNadjustments as s
on t.id = s.id
when matched then update set t.salesamount=s.salesamount
when not matched then insert (id,salesamount) values(s.id,s.salesamount);
select * from sales
Subscribe to:
Post Comments (Atom)
Search This Blog
DAX - Grouping on multiple columns and the count
Please go thorugh the below URL for entire soultion. http://community.powerbi.com/t5/Desktop/DAX-Grouping-on-multiple-columns-and-the-cou...
-
We can filter an axis based on the members, or based on the measure value. Based on the members: begins with F or after Based on th...
-
Incremental Uploads: We have got a request to need a SSIS package to incremental uploads between two sql server instances which are two d...
-
he WHERE Clause is used when you want to retrieve specific information from a table excluding other irrelevant data. For example, when you...
No comments:
Post a Comment