Преобразование SQL кода слияния сервера в эквивалентный Postgresql код - PullRequest
0 голосов
/ 18 марта 2020

Как преобразовать объединение SQL сервера в эквивалентный postgresql код: Я новичок в SQL Сервер и не знаю, как происходит слияние

merge PortfolioAssetClassBenchmark_Subset as t
 using @inputBenchmark as s
    on t.PortfolioId = @PortfolioId and t.StartDate = s.F_STARTDATE
 when matched and isnull(s.F_BENCHMARK, 0) != 0 and t.AssetClassBenchmarkId != s.F_BENCHMARK then
    update set 
    t.AssetClassBenchmarkId = s.F_BENCHMARK
 when matched and isnull(s.F_BENCHMARK, 0) = 0 then
    delete  
 when not matched by target and isnull(s.F_BENCHMARK, 0) != 0 then
    insert (PortfolioId, StartDate, AssetClassBenchmarkId)
    values (@PortfolioId, s.F_STARTDATE, s.F_BENCHMARK) 
 when not matched by source and @clearExisting != 0 then
    delete
 output  inserted.AssetClassBenchmarkId [InsertedAssetClassBenchmarkId]
    , inserted.StartDate [InsertedStartDate]
    , deleted.AssetClassBenchmarkId [DeletedAssetClassBenchmarkId]
    , deleted.StartDate [DeletedStartDate] 
 into @tmp
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...