Hi Guys
Not sure how do i proceed here . So I want to right sql query which inserts new record
If you see in the screenshot the second row is update which i can do it. No issues at all.
Regarding the third line which is insert into an existing table i am not sure how to do it.
The issue is pkdimlocationid is identity column and rest of the values are duplicate values.
So i need help in inserting record which starts with pkdimlocationid=93.
I did start the SQL code (but i lost track)which is
SELECT TOP 2 * into #temp
FROM [DimLocation]
set identity_insert[#temp] on
insert into #temp
select max(pkdimlocationid)+1 as pkdimlocationid,
code,name,type,status='Closed',L1,L2,L3,L4,L5,L6,L7,L8,L9,StDate = '2020-11-05',EdDate='2020-12-02',updatedon=cast(getdate() as date)
from DimLocation a
where code=1
group by
code,name,type,status,L1,L2,L3,L4,L5,L6,L7,L8,L9,StDate,EdDate,updatedon
set identity_insert[#temp] off
Any help would be appreciated
Screenshot:-
Farhan Jamil