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


c-sharp sql sql-server

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Introduction to Structured Query Language SQL pdf

SQL stands for Structured Query Language. SQL is a scripting language expected to store, control, and inquiry information put away in social databases. The main manifestation of SQL showed up in 1974, when a gathering in IBM built up the principal model of a social database. The primary business social database was discharged by Relational Software later turning out to be Oracle.

Introduction to Structured Query Language SQL pdf

SQL stands for Structured Query Language. SQL is a scripting language expected to store, control, and inquiry information put away in social databases. The main manifestation of SQL showed up in 1974, when a gathering in IBM built up the principal model of a social database. The primary business social database was discharged by Relational Software later turning out to be Oracle.

Welcome Back the T-SQL Debugger with SQL Complete – SQL Debugger

Debug SQL stored procedures and develop your SQL database project with dbForge SQL Complete, a new add-in for Visual Studio and SSMS. When you develop large chunks of T-SQL code with the help of the SQL Server Management Studio tool, it is essential to test the “Live” behavior of your code by making sure that each small piece of code works fine and being able to allocate any error message that may cause a failure within that code.

The Easy Guide on How to Use Subqueries in SQL Server

This article provides an outlook on various types of subqueries in SQL such as select or other T-SQL statements and caveats when using them.

How to Use SQL Server HierarchyID Through Easy Examples

This article is about SQL Server HierarchyID and which benefits you get from using hierarchyID instead of the usual parent/child relationships. Microsoft added this feature to represent one-to-many relationships with multiple levels in a better way.