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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-08-11 : 08:14:05
|
| glen kania writes "We have a table with sql statements.I want to have a SP or UDF that executes each sql statment in turn and then returns the sum of each statment. I don't want to refer to the sql in the SP/UDF as I may have different requirements for sums and the program uses the sql statements elsewhere individually. I'd want to do something like this SELECT @cret = csql from anothertable where idfield = 'firstfield'exec(@cret)and save the result which will be one rowSELECT @cret = csql from anothertable where idfield = 'secondfield'exec(@cret)and then I want to return the results of the first select and the second select. but sellect @ntot = exec(@cret) is not a valid expression.Any ideas?" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-11 : 08:53:19
|
| Not sure whether this is what you wantedSELECT @cret = csql from anothertable where idfield = 'firstfield'SELECT @cret = @cret +' ' + csql from anothertable where idfield = 'secondfield'SELECT @cretMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|