Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7796407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:21:54+00:00 2026-06-01T23:21:54+00:00

I have the following Query: Insert into tblTest (ID, Name, Age) VALUES (1, ‘TestName’,

  • 0

I have the following Query:

Insert into tblTest (ID, Name, Age) VALUES (1, 'TestName', 20);

In my trigger I want to check – if the query’s ID is equal to 1, send another query:

Insert into tblTest (ID, Name, Age) VALUES (2, 'TestName', 21);

Else, dont do anything.

The problem is, I dont know how to keep the parameters as is and just change the age, so basically I want to send the SAME query, and change a certain parameter (in this case, its the age parameter).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:21:55+00:00Added an answer on June 1, 2026 at 11:21 pm

    The rows about to be inserted can be found in the special inserted table. Here’s an example:

    if object_id('tblTest') is not null 
        drop table tblTest
    create table tblTest (id int, name varchar(50), age int)
    go
    create trigger trg_tblTest_BeforeInsert
    on tblTest
    after insert
    as begin
        insert  tblTest
        select  id + 1
        ,       name
        ,       age + 1
        from    inserted
        where   id = 1 -- Only for rows with id=1
    end
    go
    insert tblTest (id, name, age) values (1, 'TestName', 20)
    select * from dbo.tblTest
    

    This prints:

    id  name      age
    1   TestName  20
    2   TestName  21
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following query: INSERT INTO table (a, b, c) VALUES (NOW(), NOW()
I have the following query in VBA: DoCmd.RunSQL INSERT INTO table (value) VALUES ('example')
I have the following php query... INSERT INTO `demographic2` (id, name, first_name, last_name, link,
I have the following query: INSERT INTO table (a) VALUES (0) ON DUPLICATE KEY
I have following insert query: INSERT INTO `bid`.`bdate` (`id`, `bid`, `odate`) VALUES (NULL, '1',
I have the following Query : INSERT INTO users (user_id, date_created) VALUES (?,?) I
I have the following PostgreSQL query: INSERT INTO persoane_alocate(pa_id_pj,pa_id_corespondent_persoana,pa_procentaj,pa_tip_persoana,pa_data_inceput,pa_data_sfarsit,pa_afisare_in_monitor,audit_data_modificarii,audit_id_utilizator) VALUES ('670', '534', '0', '1',
I have the following query to insert into a table BULK INSERT tblMain FROM
I have the following query (all tables are innoDB) INSERT INTO busy_machines(machine) SELECT machine
I have the following code: public function createNewGuide($userID,$guideName) { $sql = INSERT INTO myTable(name,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.