How to pass the value of table 1 to table 2?

How to pass the value of table 1 to table 2?

I have a Post button in c# that when clicked, the values from table1 will be inserted to table2. I created a stored procedure in sql to execute the function but it's not inserting the values to table2.

I have a Post button in c# that when clicked, the values from table1 will be inserted to table2. I created a stored procedure in sql to execute the function but it's not inserting the values to table2.

alter procedure sp_smpInsert_table2
  @Batch_id varchar(50)
as
  declare @Season_id varchar(50),@Style_id varchar (50),@Recid varchar(50)

select a.Recid, a.Season_id, a.Style_id from table1 a where a.Style_id not in ( select b.style_id from table2 b where b.Style_id = a.Style_ID and b.Season_id = a.Season_id ) and a.Batch_id = @Batch_id and isnull(a.Posted,0) <> 1

if not exists (select top 1 1 from table2 where [email protected]_id and Season_id = @Season_id) begin insert into table2 (Recid, t0, Season_id, Style_id, Model_id, Model_Name, bu_team , Status_Desc, iPLEXi_dev_team, [User_id], SizeGroup_id, Base_size, Factory_code , Garment_Lead_time, Prod_type_id, Buy_ready_dt, t1, t1_factory_id, t2, t2_factory_id) select c.Recid, c.T0, c.Season_id, c.Style_ID, c.Model_ID, c.Product_Name, c.BU_Team , case when c.Upld_type = 'Sample Style Header' THEN 'DV' ELSE 'PD' END AS STATUS_DESC , c.Dev_Team, c.Gender, c.Size_PageID, c.Base_Size, c.Fty_Code, c.Lead_Time , c.Product_Type, c.EBR_Model, c.T1, c.T1_factory_id, c.T2, c.T2_factory_id from table1 c where c.Batch_id = @Batch_id and c.Recid = @Recid and ISNULL(Posted,0)<>1 end


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

SQL Server Tutorial For Beginners - Learn MS SQL Server with Examples

SQL Server Tutorial For Beginners, Microsoft SQL Server Tutorial, SQL Server Training. Microsoft SQL Server explains all the fundamentals of MS SQL Server with examples. What is DBMS? What is SQL? What is SQL Server? SQL Server Installation

C/C++ vs. Rust: A developer’s perspective

In this post, you'll see the difference between Rust and C/C++ in a developer’s perspective