sorry, 2005.
I know I picked that when I started this thread.
>And SQL Server version?
>
>>10 records is the max in a group.
>>
>>the result table is used for reports.
>>
>>>How many records (max) can be in a group? SQL Server version? What result table is used for?
>>>
>>>>Sorry, was missing a field in the first table, that id's the groups.
>>>>
>>>>>Hi Beth,
>>>>>
>>>>>It's not clear how do you know which records to combine?
>>>>>
>>>>>>
>>>>>>Okay, In the calling vfp program, I create a huge temp table called #bptable. Then I want to call this stored procedure that gets information for several different tables, including another temp table. I take the result of that select statement, and build a string, because I use many records for the result to create one record in the temp table:
>>>>>>
>>>>>>
>>>>>>result table
>>>>>>st_id name place time rtw_id
>>>>>> 1 First Missoula 12:01 PM 1
>>>>>> 2 Second Billings 06:35 AM 1
>>>>>> 5 Third Canada 08:44 AM 1
>>>>>> 8 First Lincoln 08:00 AM 2
>>>>>>
>>>>>>
>>>>>>New Temp Table
>>>>>>newid st_id name place time st_id1 name1 place1 time1 st_id2 name2 place2 time2
>>>>>> 1 1 First Missoula 12:01 PM 2 Second Billings 06:35 AM 5 Third Canada 08:44 AM
>>>>>> 2 8 First Lincoln 08:00 AM
>>>>>>
>>>>>>
>>>>>>
>>>>>>In vfp, I loop through the records and do an insert after each string is completely built.
>>>>>>
>>>>>>Is there a better way to do this?
>>>>>>Can this string be built in SP?
>>>>>>
>>>>>>TIA
>>>>>>Beth