Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

simple : insert row then set parameter to scope_identity

Posted on 2009-07-16
1
Medium Priority
?
1,170 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 2000 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

704 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