Solved

simple : insert row then set parameter to scope_identity

Posted on 2009-07-16
1
1,168 Views
Last Modified: 2013-11-10
im trying to insert a new row inside an execute sql task and store the scope_identity() into a variable, this is proving harder than I would have thought.

I have amanged to store it to a result set by doing

Insert into &.. ;
Select scope_identity();

 But then I have to use a loop to get the individual column from the result set, I dont like doing this because I only have one row so seems silly to loop through one row..

If you have any ideas, it would be appreciated.
0
Comment
Question by:crazyman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 22

Accepted Solution

by:
PedroCGD earned 500 total points
ID: 24867772
use an output parameter inside a stored procedure to send the identity to a SSIS variable...
need an example?!

Helped?
Regards,
Pedro
www.pedrocgd.blogspot.com
www.BIResort.net
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question