Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Aggregating multiple rows from external source

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-03-27 : 16:23:39
yaeiou2k writes "I have been trying to find an easy/efficient way of aggregating multiple rows of data into one variable.


I have a store procedure that runs an external program, ie
xp_cmdshell 'myprogram.exe ' & @para1 ....

xp_cmdshell returns (N) rows of data type varchar(255), depending how long the output of the external program is. In my case,
I receive back 5 rows of data. However, i would like to,
1) aggregrate the rows into 1 value
2) store this value into a declared variable within the procedure for further use.

From what i know, a cursor can not reference a xp_cmdshell as a source; so the methods I have read about on site are not plausible. Also, from what i know, the returned data (the 5 rows) can't be stored into a temporary table for futher manipulation.

Is there an easy way of aggregating/storing the aggregate into a local variable, from the output of the external program execution?"
   

- Advertisement -