Wednesday, March 7, 2012
inserting\update line numbering
what SQL statement do I use in order to add the line numbering for each line, and have it dependent on reseting on the sales order number?If this is a one-time operation, usually a temp table is created with an identity. In other cases you may need to add an identity column to the table.|||If this is a one-time operation, usually a temp table is created with an identity. In other cases you may need to add an identity column to the table.
This is a daily build operation
Using Identity though creates the numbering for all records in the table (sees it as one order (500 records, records numbered from 1 to 500?)
I am looking at the line numbering to reset back to 1 everytime there is a change in the order number field (inv_ref field)
this can't be done through identity?|||My guess is, that it would be possible using an identity column, but I wouldn't go for that if it needs to be reset on a daily basis.
It's probably me, but I'm still not quite clear on what you want, on the other hand, maybe I do but miss the point as to why you need a linenumber associated with the table contents.
One of these might work for you though:
- create a view that has a computed column (if the linenumber can be determined on other information from the table);
- create a trigger that does an update (guess this can be quite a burden);
- create an sp; do an update based on identity from a temp-table.|||line number id forms part of the primary key make up.
I have Invoice number, sales order number, and line id
I can't include product id instead of line id as in an invoice there may be a reference to the same product id i.e. at line 1 and 10.
I guess a messy way of going about it is to just use identity and leave the count go on the entire table just to satisfy the primary key requirements.
Inserting XML with SSIS - VERY URGENT!!!
Hello everybody,
I have a problem. I need to insert an unknown number of xml files in a database (all files are always in the same folder), in different tables, each file has the same name that the corresponding table. For example:
Files Tables
user.xml user
purchase.xml purchase
...and so
but the number of files is not always the same, I mean, it can be 6 one day and only 4 the next day.
Can I insert the data in the xml files into the tables with a Foreach Loop Container or any other way? If it's possible, how?
Thanks in advance for your help,
Radamante71
You might want to post your question at SQL Server Integration Services forum at http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=80&SiteID=1.
Inserting with XML files - VERY URGENT!!!
I have a problem. I need to insert an unknown number of xml files in a database (all files are always in the same folder), in different tables, each file has the same name that the corresponding table. For example:
Files Tables
user.xml user
purchase.xml purchase
...and so
but the number of files is not always the same, I mean, it can be 6 one day and only 4 the next day.
Can I insert the data in the xml files into the tables with a Foreach Loop Container or any other way? If it's possible, how?
Thanks in advance for your help,
Radamante71
Create a ForEach Loop task to read the files from the directory and assign the name to a variable. Then add a dataflow task to the foreach loop and in your XML source file, select "XML File from variable", then select the variable name.|||Tom suggestion will work if all file/tables had the same structure, which I doubt. To the original poster: I think what you want to accomplish is not possible. Basically you are asking to create the source-to-target data mapping on the fly and that is something you cannot do in a SSIS package (at least to my knowledge).
Rafael Salas
|||Rafael,
One question:
Do you speak spanish? Because if you do, we can continue in spanish. I'm spanish and I think that I can explain you my problem in a better way if I do it in my language.
Thanks
|||You are correct. I don't see any way to use a variable XSD file.
However, you could use the "Inline Schema" in the file, that would work.|||
Radamante,
Yes, I do speak; but I don't think it would be a good idea to continue this thread in Spanish; that could irritate some non-Spanish speaker folks in this forum. If you want, send me an e-mail with your problem (be sure to de-spam my email address before) to see if I can help you.
Rafael Salas