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 3280884
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:45:16+00:00 2026-05-17T19:45:16+00:00

SQL Server 2005+ I have a view with an INSTEAD OF INSERT trigger. Inside

  • 0

SQL Server 2005+

I have a view with an INSTEAD OF INSERT trigger. Inside the body of the trigger, I want to use a statement with an OUTPUT clause which references both INSERTED tables:

  • the outer INSERTED table for the INSTEAD OF INSERT trigger
  • the inner INSERTED table for the OUTPUT clause

MSDN says this:

If a statement that includes an OUTPUT clause is used inside the body of a trigger, table aliases must be used to reference the trigger inserted and deleted tables to avoid duplicating column references with the INSERTED and DELETED tables associated with OUTPUT.

But aliasing doesn’t seem to work:

CREATE TRIGGER v_insert ON v
INSTEAD OF INSERT
AS BEGIN
  INSERT INTO t (a, b, c)
  OUTPUT inserted.a, inserted.b, outer_inserted.d INTO t_prime (a, b, d)
  SELECT a, b, c
  FROM inserted as outer_inserted
END

It produces the error “The multi-part identifier “outer_inserted.d” could not be bound. Does that mean what I’m trying to do is not possible?

  • 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-05-17T19:45:17+00:00Added an answer on May 17, 2026 at 7:45 pm

    I read it as the INSERTED alias would be required in the FROM where you access the trigger INSERTED.

    The INSERTED in the OUTPUT clause can only reference the data inserted into t.

    So you can’t have outer_inserted.d in your OUTPUT clause

    Nor can you do this, which is how I read it

    INSERT INTO t (a, b, c)
      OUTPUT inserted.a, inserted.b INTO t_prime (a, b)
      SELECT a, b, c
      FROM inserted --no alias = **FAIL**
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a list of columns in SQL Server 2005 that have
SQL Server 2005 I have 10 million rows in DB, and run a select
In SQL Server 2005 I have an id field in a table that has
In Sql Server 2005 when I have multiple parameters do I have the guarantee
SQL Server (2005/2008) Each of the below statements have the same result. Does anyone
I have a SQL Server 2005 database and I have 4 GB of text
We have a Microsoft SQL Server 2005 database that needs to be converted back
I have a SQL Server 2005 table like this: create table Taxonomy( CategoryId integer
We have a production SQL Server 2005 database server with the production version of
I have a SQL Server 2005 database that is suffering from lock starvation because

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.