Home Forums SQL Server 2005 T-SQL (SS2K5) How to Build a single row with groups of fields from several rows per key RE: How to Build a single row with groups of fields from several rows per key

  • Thanks for your questions I had to think about it in advance in my explanation.

    0. I'm assuming that the data-type in the original table for the 3 entries for each group is INT. Is that correct?

    Mixed in and Nvarchar fields

    1. What do you want to return for a customer with 0 groups and how will that be manifested in the original table.

    Nullified fields

    2. Also, since you're sending this to a customer and it sounds a whole lot like they're going to be importing the data either into a spreadsheet or a table, what do you want for delimiters between the "columns" of data in the output? Commas? Tabs? or ...

    I am sending it from a WebService so XML data

    3. ... or do you want this to be a fixed field format? If so, what are the data-types in the 3 values of each group in the original table? Need to know this to be able to handle the max width.

    It is fixed format so it has 9 fields per customer/group of fields. A customer with no optional trailer rows (Orders?) all its fields will (stay) nullified.

    The number of Customers handled is of small volume (between 1 to 10?) each with 0 to 15 batches/groups of 9 fields.

    I hope I am now clear enough,

    Thanks