sql server dts:
I need to import a flat file as follows: Column1,Column2,Column3 1,2,3 4,5,6 (snip) 123,456,789 Downloaded from www.abcdef.com on 02/28/2007. Total1: 12344556 Total2: 234523 Total3: 56456 Copyright 2004-2007 by ABCDEF Group LLC. All Rights Reserved. The last line is some kind of signature. I have no problems uploading data lines from 1,2,3 to 123,456,789. The last line is ignored, which is OK. I have 2 problems I cannot solve right now: 1. I need to upload the last line into some other staging table to do some validation, such as to match totals against my control numbers and to verify the date. 2. I need to have line numbers from the text in my target table: LineNumber,Column1,Column2,Column3 1,1,2,3 2,4,5,6 (snip) 300,123,456,789 I think there should be a transformation to add line numbers, but I cannot find any so far. Thanks in advance. BTW, am I asking in the correct newsgroups?
[quoted text, click to view] On Mar 5, 4:16 pm, "Allan Mitchell" <a...@no-spam.sqldts.com> wrote: > You could use this if you want > > Row Number Transformation > ( http://www.sqlis.com/93.aspx) > > -- > > Allan Mitchell http://wiki.sqlis.com| http://www.sqlis.com| http://www.sqldts.com| http://www.konesans.com > > "sqllear...@hotmail.com" <sqllear...@hotmail.com> wrote in message > > news:1173120358.175979.163580@30g2000cwc.googlegroups.com: > > > > > I need to import a flat file as follows: > > > Column1,Column2,Column3 > > 1,2,3 > > 4,5,6 > > (snip) > > 123,456,789 > > Downloaded from www.abcdef.comon 02/28/2007. Total1: 12344556 > > Total2: > > 234523 Total3: 56456 Copyright 2004-2007 by ABCDEF Group LLC. All > > Rights Reserved. > > > The last line is some kind of signature. I have no problems uploading > > data lines from 1,2,3 to 123,456,789. > > The last line is ignored, which is OK. > > > I have 2 problems I cannot solve right now: > > 1. I need to upload the last line into some other staging table to do > > some validation, such as to match totals against my control numbers > > and to verify the date. > > 2. I need to have line numbers from the text in my target table: > > > LineNumber,Column1,Column2,Column3 > > 1,1,2,3 > > 2,4,5,6 > > (snip) > > 300,123,456,789 > > > I think there should be a transformation to add line numbers, but I > > cannot find any so far. > > > Thanks in advance. BTW, am I asking in the correct newsgroups?- Hide quoted text - > > - Show quoted text - Thanks Simon and Alan
Hello SQL, Its easy to do in a script component, I've done a demo of this here http://sqlblogcasts.com/blogs/simons/archive/2007/03/05/SSIS---How-do-I-add-rownumber-line-number-to-a-data-flow.aspx or use the component from Jamie Thomson http://blogs.conchango.com/jamiethomson/archive/2006/09/12/SSIS_3A00_-Rank-Transform.aspx Simon Sabin SQL Server MVP http://sqlblogcasts.com/blogs/simons [quoted text, click to view] > I need to import a flat file as follows: > > Column1,Column2,Column3 > 1,2,3 > 4,5,6 > (snip) > 123,456,789 > Downloaded from www.abcdef.com on 02/28/2007. Total1: 12344556 > Total2: > 234523 Total3: 56456 Copyright 2004-2007 by ABCDEF Group LLC. All > Rights Reserved. > The last line is some kind of signature. I have no problems uploading > data lines from 1,2,3 to 123,456,789. > The last line is ignored, which is OK. > I have 2 problems I cannot solve right now: > 1. I need to upload the last line into some other staging table to do > some validation, such as to match totals against my control numbers > and to verify the date. > 2. I need to have line numbers from the text in my target table: > LineNumber,Column1,Column2,Column3 > 1,1,2,3 > 2,4,5,6 > (snip) > 300,123,456,789 > I think there should be a transformation to add line numbers, but I > cannot find any so far. > > Thanks in advance. BTW, am I asking in the correct newsgroups? >
You could use this if you want Row Number Transformation ( http://www.sqlis.com/93.aspx) -- Allan Mitchell http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com | http://www.konesans.com [quoted text, click to view] "sqllearner@hotmail.com" <sqllearner@hotmail.com> wrote in message news:1173120358.175979.163580@30g2000cwc.googlegroups.com: > I need to import a flat file as follows: > > Column1,Column2,Column3 > 1,2,3 > 4,5,6 > (snip) > 123,456,789 > Downloaded from www.abcdef.com on 02/28/2007. Total1: 12344556 > Total2: > 234523 Total3: 56456 Copyright 2004-2007 by ABCDEF Group LLC. All > Rights Reserved. > > > The last line is some kind of signature. I have no problems uploading > data lines from 1,2,3 to 123,456,789. > The last line is ignored, which is OK. > > > I have 2 problems I cannot solve right now: > 1. I need to upload the last line into some other staging table to do > some validation, such as to match totals against my control numbers > and to verify the date. > 2. I need to have line numbers from the text in my target table: > > > LineNumber,Column1,Column2,Column3 > 1,1,2,3 > 2,4,5,6 > (snip) > 300,123,456,789 > > > I think there should be a transformation to add line numbers, but I > cannot find any so far. > > > Thanks in advance. BTW, am I asking in the correct newsgroups?
Hello Allan, The script component rules ;) Simon Sabin SQL Server MVP http://sqlblogcasts.com/blogs/simons [quoted text, click to view] > You could use this if you want > > Row Number Transformation > ( http://www.sqlis.com/93.aspx) > -- > > Allan Mitchell > http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com | > http://www.konesans.com > "sqllearner@hotmail.com" <sqllearner@hotmail.com> wrote in message > news:1173120358.175979.163580@30g2000cwc.googlegroups.com: > >> I need to import a flat file as follows: >> >> Column1,Column2,Column3 >> 1,2,3 >> 4,5,6 >> (snip) >> 123,456,789 >> Downloaded from www.abcdef.com on 02/28/2007. Total1: 12344556 >> Total2: >> 234523 Total3: 56456 Copyright 2004-2007 by ABCDEF Group LLC. All >> Rights Reserved. >> The last line is some kind of signature. I have no problems uploading >> data lines from 1,2,3 to 123,456,789. >> The last line is ignored, which is OK. >> I have 2 problems I cannot solve right now: >> 1. I need to upload the last line into some other staging table to do >> some validation, such as to match totals against my control numbers >> and to verify the date. >> 2. I need to have line numbers from the text in my target table: >> LineNumber,Column1,Column2,Column3 >> 1,1,2,3 >> 2,4,5,6 >> (snip) >> 300,123,456,789 >> I think there should be a transformation to add line numbers, but I >> cannot find any so far. >> >> Thanks in advance. BTW, am I asking in the correct newsgroups? >>
Don't get me started :-> -- Allan Mitchell http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com | http://www.konesans.com [quoted text, click to view] "Simon Sabin" <SimonSabin@noemail.noemail> wrote in message news:62959f1a50d078c92d8c0be962c2@msnews.microsoft.com: > Hello Allan, > > The script component rules ;) > > > Simon Sabin > SQL Server MVP > http://sqlblogcasts.com/blogs/simons > > > > You could use this if you want > > > > Row Number Transformation > > ( http://www.sqlis.com/93.aspx) > > -- > > > > Allan Mitchell > > http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com | > > http://www.konesans.com > > "sqllearner@hotmail.com" <sqllearner@hotmail.com> wrote in message > > news:1173120358.175979.163580@30g2000cwc.googlegroups.com: > > > >> I need to import a flat file as follows: > >> > >> Column1,Column2,Column3 > >> 1,2,3 > >> 4,5,6 > >> (snip) > >> 123,456,789 > >> Downloaded from www.abcdef.com on 02/28/2007. Total1: 12344556 > >> Total2: > >> 234523 Total3: 56456 Copyright 2004-2007 by ABCDEF Group LLC. All > >> Rights Reserved. > >> The last line is some kind of signature. I have no problems uploading > >> data lines from 1,2,3 to 123,456,789. > >> The last line is ignored, which is OK. > >> I have 2 problems I cannot solve right now: > >> 1. I need to upload the last line into some other staging table to do > >> some validation, such as to match totals against my control numbers > >> and to verify the date. > >> 2. I need to have line numbers from the text in my target table: > >> LineNumber,Column1,Column2,Column3 > >> 1,1,2,3 > >> 2,4,5,6 > >> (snip) > >> 300,123,456,789 > >> I think there should be a transformation to add line numbers, but I > >> cannot find any so far. > >> > >> Thanks in advance. BTW, am I asking in the correct newsgroups? > >>
I think the article does not mean it will not label each line correctly rather it may not number them in the order you expect them to be numbered. Yes our component behaves in a very similar way to this code except we allow seeding and increments. -- Allan Mitchell http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com | http://www.konesans.com [quoted text, click to view] "SQL Learner" <sqllearner@hotmail.com> wrote in message news:1173192125.412108.314920@t69g2000cwt.googlegroups.com: > On Mar 5, 4:16 pm, "Allan Mitchell" <a...@no-spam.sqldts.com> wrote: > > You could use this if you want > > > > RowNumberTransformation > > ( http://www.sqlis.com/93.aspx) > > > > -- > > > > Allan Mitchell http://wiki.sqlis.com| http://www.sqlis.com| http://www.sqldts.com| http://www.konesans.com > > > > "sqllear...@hotmail.com" <sqllear...@hotmail.com> wrote in message > > > > news:1173120358.175979.163580@30g2000cwc.googlegroups.com: > > > > > > > > > I need to import a flat file as follows: > > > > > Column1,Column2,Column3 > > > 1,2,3 > > > 4,5,6 > > > (snip) > > > 123,456,789 > > > Downloaded from www.abcdef.comon 02/28/2007. Total1: 12344556 > > > Total2: > > > 234523 Total3: 56456 Copyright 2004-2007 by ABCDEF Group LLC. All > > > Rights Reserved. > > > > > The last line is some kind of signature. I have no problems uploading > > > data lines from 1,2,3 to 123,456,789. > > > The last line is ignored, which is OK. > > > > > I have 2 problems I cannot solve right now: > > > 1. I need to upload the last line into some other staging table to do > > > some validation, such as to match totals against my control numbers > > > and to verify the date. > > > 2. I need to have line numbers from the text in my target table: > > > > > LineNumber,Column1,Column2,Column3 > > > 1,1,2,3 > > > 2,4,5,6 > > > (snip) > > > 300,123,456,789 > > > > > I think there should be a transformation to add line numbers, but I > > > cannot find any so far. > > > > > Thanks in advance. BTW, am I asking in the correct newsgroups?- Hide quoted text - > > > > - Show quoted text - > > > Allan, > > Is your solution similar to the following: > > http://support.microsoft.com/kb/908460 > > If yes, I have a concern: MSDN says "The mycount column does not > necessarily reflect the actual row number in the original source." > Does your solution provide a reliable way of numbering lines in a text > file? > > TIA
[quoted text, click to view] On Mar 5, 4:16 pm, "Allan Mitchell" <a...@no-spam.sqldts.com> wrote: > You could use this if you want > > RowNumberTransformation > ( http://www.sqlis.com/93.aspx) > > -- > > Allan Mitchell http://wiki.sqlis.com| http://www.sqlis.com| http://www.sqldts.com| http://www.konesans.com > > "sqllear...@hotmail.com" <sqllear...@hotmail.com> wrote in message > > news:1173120358.175979.163580@30g2000cwc.googlegroups.com: > > > > > I need to import a flat file as follows: > > > Column1,Column2,Column3 > > 1,2,3 > > 4,5,6 > > (snip) > > 123,456,789 > > Downloaded from www.abcdef.comon 02/28/2007. Total1: 12344556 > > Total2: > > 234523 Total3: 56456 Copyright 2004-2007 by ABCDEF Group LLC. All > > Rights Reserved. > > > The last line is some kind of signature. I have no problems uploading > > data lines from 1,2,3 to 123,456,789. > > The last line is ignored, which is OK. > > > I have 2 problems I cannot solve right now: > > 1. I need to upload the last line into some other staging table to do > > some validation, such as to match totals against my control numbers > > and to verify the date. > > 2. I need to have line numbers from the text in my target table: > > > LineNumber,Column1,Column2,Column3 > > 1,1,2,3 > > 2,4,5,6 > > (snip) > > 300,123,456,789 > > > I think there should be a transformation to add line numbers, but I > > cannot find any so far. > > > Thanks in advance. BTW, am I asking in the correct newsgroups?- Hide quoted text - > > - Show quoted text - Allan, Is your solution similar to the following: http://support.microsoft.com/kb/908460 If yes, I have a concern: MSDN says "The mycount column does not necessarily reflect the actual row number in the original source." Does your solution provide a reliable way of numbering lines in a text file? TIA
[quoted text, click to view] On Mar 6, 8:51 am, "Allan Mitchell" <a...@no-spam.sqldts.com> wrote: > I think the article does not mean it will not label each line correctly > rather it may not number them in the order you expect them to be > numbered. Yes our component behaves in a very similar way to this code > except we allow seeding and increments. > > -- > > Allan Mitchell http://wiki.sqlis.com| http://www.sqlis.com| http://www.sqldts.com| http://www.konesans.com > > "SQL Learner" <sqllear...@hotmail.com> wrote in message > > news:1173192125.412108.314920@t69g2000cwt.googlegroups.com: > > > > > On Mar 5, 4:16 pm, "Allan Mitchell" <a...@no-spam.sqldts.com> wrote: > > > You could use this if you want > > > > RowNumberTransformation > > > ( http://www.sqlis.com/93.aspx) > > > > -- > > > > Allan Mitchell http://wiki.sqlis.com| http://www.sqlis.com| http://www.sqldts.com| http://www.konesans.com > > > > "sqllear...@hotmail.com" <sqllear...@hotmail.com> wrote in message > > > >news:1173120358.175979.163580@30g2000cwc.googlegroups.com: > > > > > I need to import a flat file as follows: > > > > > Column1,Column2,Column3 > > > > 1,2,3 > > > > 4,5,6 > > > > (snip) > > > > 123,456,789 > > > > Downloaded from www.abcdef.comon02/28/2007. Total1: 12344556 > > > > Total2: > > > > 234523 Total3: 56456 Copyright 2004-2007 by ABCDEF Group LLC. All > > > > Rights Reserved. > > > > > The last line is some kind of signature. I have no problems uploading > > > > data lines from 1,2,3 to 123,456,789. > > > > The last line is ignored, which is OK. > > > > > I have 2 problems I cannot solve right now: > > > > 1. I need to upload the last line into some other staging table to do > > > > some validation, such as to match totals against my control numbers > > > > and to verify the date. > > > > 2. I need to have line numbers from the text in my target table: > > > > > LineNumber,Column1,Column2,Column3 > > > > 1,1,2,3 > > > > 2,4,5,6 > > > > (snip) > > > > 300,123,456,789 > > > > > I think there should be a transformation to add line numbers, but I > > > > cannot find any so far. > > > > > Thanks in advance. BTW, am I asking in the correct newsgroups?- Hide quoted text - > > > > - Show quoted text - > > > Allan, > > > Is your solution similar to the following: > > > http://support.microsoft.com/kb/908460 > > > If yes, I have a concern: MSDN says "The mycount column does not > > necessarily reflect the actual row number in the original source." > > Does your solution provide a reliable way of numbering lines in a text > > file? > > > TIA- Hide quoted text - > > - Show quoted text - I'm afraid I'm not following you. I expect lines in a text file (unlike a database table) to be numbered from top to bottom, and anything esle is incorrect. For instance, given a file 23.2,17,5 23.1,16,4 I expect it to transform to 1,23.2,17,5 2,23.1,16,4 I think any other numbering is not correct. TIA
If the data appears into the pipeline in that order then our component should number in tht order (order the data is seen) -- Allan Mitchell http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com | http://www.konesans.com [quoted text, click to view] "SQL Learner" <sqllearner@hotmail.com> wrote in message news:1173193865.157871.73620@t69g2000cwt.googlegroups.com: > On Mar 6, 8:51 am, "Allan Mitchell" <a...@no-spam.sqldts.com> wrote: > > I think the article does not mean it will not label each line correctly > > rather it may not number them in the order you expect them to be > > numbered. Yes our component behaves in a very similar way to this code > > except we allow seeding and increments. > > > > -- > > > > Allan Mitchell http://wiki.sqlis.com| http://www.sqlis.com| http://www.sqldts.com| http://www.konesans.com > > > > "SQL Learner" <sqllear...@hotmail.com> wrote in message > > > > news:1173192125.412108.314920@t69g2000cwt.googlegroups.com: > > > > > > > > > On Mar 5, 4:16 pm, "Allan Mitchell" <a...@no-spam.sqldts.com> wrote: > > > > You could use this if you want > > > > > > RowNumberTransformation > > > > ( http://www.sqlis.com/93.aspx) > > > > > > -- > > > > > > Allan Mitchell http://wiki.sqlis.com| http://www.sqlis.com| http://www.sqldts.com| http://www.konesans.com > > > > > > "sqllear...@hotmail.com" <sqllear...@hotmail.com> wrote in message > > > > > >news:1173120358.175979.163580@30g2000cwc.googlegroups.com: > > > > > > > I need to import a flat file as follows: > > > > > > > Column1,Column2,Column3 > > > > > 1,2,3 > > > > > 4,5,6 > > > > > (snip) > > > > > 123,456,789 > > > > > Downloaded from www.abcdef.comon02/28/2007. Total1: 12344556 > > > > > Total2: > > > > > 234523 Total3: 56456 Copyright 2004-2007 by ABCDEF Group LLC. All > > > > > Rights Reserved. > > > > > > > The last line is some kind of signature. I have no problems uploading > > > > > data lines from 1,2,3 to 123,456,789. > > > > > The last line is ignored, which is OK. > > > > > > > I have 2 problems I cannot solve right now: > > > > > 1. I need to upload the last line into some other staging table to do > > > > > some validation, such as to match totals against my control numbers > > > > > and to verify the date. > > > > > 2. I need to have line numbers from the text in my target table: > > > > > > > LineNumber,Column1,Column2,Column3 > > > > > 1,1,2,3 > > > > > 2,4,5,6 > > > > > (snip) > > > > > 300,123,456,789 > > > > > > > I think there should be a transformation to add line numbers, but I > > > > > cannot find any so far. > > > > > > > Thanks in advance. BTW, am I asking in the correct newsgroups?- Hide quoted text - > > > > > > - Show quoted text - > > > > > Allan, > > > > > Is your solution similar to the following: > > > > > http://support.microsoft.com/kb/908460 > > > > > If yes, I have a concern: MSDN says "The mycount column does not > > > necessarily reflect the actual row number in the original source." > > > Does your solution provide a reliable way of numbering lines in a text > > > file? > > > > > TIA- Hide quoted text - > > > > - Show quoted text - > > > I'm afraid I'm not following you. I expect lines in a text file > (unlike a database table) to be numbered from top to bottom, and > anything esle is incorrect. For instance, given a file > > 23.2,17,5 > 23.1,16,4 > > I expect it to transform to > > 1,23.2,17,5 > 2,23.1,16,4 > > I think any other numbering is not correct. > > TIA
Hello SQL, If you have just got a flat file source then the data should be put on the pipeline in the order the data is read from the file. Ths note covers the fact that components may not preserve the order of the pipeline, i.e a component may take all the rows in a buffer and output them in another order. If a component is synchronous then it cannot alter the order of data in a pipeline. It can remove data but not change the order. Simon Sabin SQL Server MVP http://sqlblogcasts.com/blogs/simons
If a component is synchronous then every row that comes in will go out. There is now swapping of buffers (Async) and you cannot stop the data from re-emerging AFAIK. -- Allan Mitchell http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com | http://www.konesans.com [quoted text, click to view] "Simon Sabin" <SimonSabin@noemail.noemail> wrote in message news:62959f1a517478c92e207f4d12d8@msnews.microsoft.com: > Hello SQL, > > If you have just got a flat file source then the data should be put on the > pipeline in the order the data is read from the file. Ths note covers the > fact that components may not preserve the order of the pipeline, i.e a component > may take all the rows in a buffer and output them in another order. If a > component is synchronous then it cannot alter the order of data in a pipeline. > It can remove data but not change the order. > > > Simon Sabin > SQL Server MVP > http://sqlblogcasts.com/blogs/simons
Don't see what you're looking for? Try a search.
|