create one insert stored for multiple tables

I had applicant project with multiple pages as the user will go through these pages to complete his applicant data then at the last page he will find submit the data.

My problem is that, I have multiple tables and when the user submit his data the data will inserted into it’s table , so how can I create one stored for all these table .

  • Using SSIS variable (@) as part of UPDATE in `Execute Sql Server Task'?
  • SQL Query returns multiple rows of the same record when View includes one-to-many table
  • CTE to display org char hierarchy?
  • How to use SqlCommand to CREATE DATABASE with parameterized db name?
  • What could be good ways to deploy ASP.Net Web Applications?
  • TSQL: Check that a varchar can be converted to a number
  • Eloquent with declared table to use in the query
  • Cannot use Alias name in WHERE clause but can in ORDER BY
  • Query to fall back on different columns
  • SQL Server: Server-side blob cursor?
  • Windows phone mango with SQL Server
  • SQL CE Compact 3.5 Identity columns for a table
  • 2 Solutions collect form web for “create one insert stored for multiple tables”

    If you want to insert/update several tables at once, you would be better off using a stored procedure. Create/Read/Update/Delete (CRUD) stored procedure are generally good practice and reduce the risk of SQL injection attacks.

    Here’s what your Create (insert) stored procedure might look like (it’s incomplete and unnormalized):

    CREATE PROCEDURE [dbo].[ApplicantIns]
    (   
        @Name   nvarchar(50)
        ,@Skill nvarchar(5)
        ,@Age   int
        ,@comment nvarchar(50)
    )
    AS
        SET NOCOUNT ON;
    
        INSERT INTO [dbo].[Applicant]([name]) VALUES(@Name);
    
        INSERT INTO [dbo].[Skillset]([Skill], [Comment]) VALUES(@Skill,@Comment);
    
        INSERT INTO [dbo].[Statistics]([Age]) VALUES (@Age);
    

    You could then call this stored procedure when someone submits a new application.

    Are you using .NET Framework? If so, what version?

    In case you’re using .NET > 3.5 + MS SQL 2008 you can use table valued parameters

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.