July 11, 2012 at 1:53 pm
During file transfer into SQL Server, I am trying to assign a unique sequencial number after certain line meets the criteria. For example, in the file, if a line starts with CLM, I will create a new line right below it with a unique number. This number should increment throughout the file and be remembered for the next file to be process.
Is there a easy way I can use SSIS Script Component script code to accomplish the task?
Thanks in advance.
Sheridan
July 11, 2012 at 10:48 pm
I don't know much about SSIS but if you're inserting into a table, use an IDENTITY column to generate a unique number.
My thought question: Have you ever been told that your query runs too fast?
My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
Since random numbers are too important to be left to chance, let's generate some![/url]
Learn to understand recursive CTEs by example.[/url]
[url url=http://www.sqlservercentral.com/articles/St
July 11, 2012 at 11:47 pm
Use row number transformations.
July 11, 2012 at 11:55 pm
sheridan.zhu (7/11/2012)
During file transfer into SQL Server, I am trying to assign a unique sequencial number after certain line meets the criteria. For example, in the file, if a line starts with CLM, I will create a new line right below it with a unique number. This number should increment throughout the file and be remembered for the next file to be process.Is there a easy way I can use SSIS Script Component script code to accomplish the task?
Thanks in advance.
Sheridan
Create a variable at package level.
--rhythmk
------------------------------------------------------------------
To post your question use below link
https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
🙂
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply