How To Generate a value
Hi ;
I have a scenario like in which my data is coming from excel but in the database we have a one column that column value we needs to feel @ run time
Example
My excel looks like this
Name Dept Phone
A Pu 123
B Sa 455
C AS 777
and so on
Now I want my o/p as
ame Dept Phone Number
A Pu 123 1
B Sa 455 2
C AS 777 3
and so on
For example I have set number value starts from 1 but in our system we have facility that user can start from any number
and we can't do it from db by setting identity value ,so what willl be the other alternative please help
August 20th, 2011 10:44am
How do you want to pass the startvalue to the package?
You can take a variable and increase this variable in a derived column or a script component.
If you can move the numbering to SQL Server, you can use row_number() for this:
import the data into a staging table and insert into the destination like this:
declare @start int
set @start = 0
insert into destination (...)
select ..., @start + row_number() over (order by field) as no
from stagingtable
Free Windows Admin Tool Kit Click here and download it now
August 20th, 2011 12:23pm