How to preserve the Calculation View data into a permanent table using Stored Procedure.
Ex: Calculation View having Column1, Column2, Column3, Column4, Column5, Column6 Column7
In which Column1, Column2, Column3, Column4, Column5 makes Distinct (composite key)
Permanent Table having similar structure with columns & same data type of that calculation view
Columns : Column1, Column2, Column3, Column4, Column5, Column6 Column7
Primary key : Column1, Column2, Column3, Column4, Column5 (composite key)
How to preserve the Calculation view data into Permanent table without allowing duplicates.
If i used syntax like Select Columns from Calculation view into permanent table.
First time it entries but when 2nd time new records exists in calculation view, few data already exists in Permanent table in that time it will fail to insert because of primary key...
So it should update the data with Primary key condition, if it not exists then it should insert into permanent table.
& i also tried with UPSERT Statement but not getting correct result.
once i call the stored procedure, data has to pull out from calculation view, If exists it should update the records, else insert the new records into permanent table
Please suggest how to resolve this issue.