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 2005 Forums
 Transact-SQL (2005)
 Execute Stored Procdure in a Function

Author  Topic 

cobra429
Starting Member

4 Posts

Posted - 2008-09-24 : 08:17:37
Does anyone know if it is possible to call a stored procedure inside a table valued function?

The problem stems from a need to do a pivot against an unknown set of columns to retrieve one row of data for a series of common ids. For instance, we have table A with the parent say product. In table be there are a number of attributes that describe values for attributes about the product (size, height, weight etc.). Basically we are trying to denormalize a table on the fly.

The stored procedure to crosstab or pivot the data is fairly easy to write (using dynamic SQL). I know it is bad, but the only way I can think to do the denomralization. The problem is with getting the result set so other procedures can utilize the data. This is where the table valued stored procedure would work great. My understanding is that you cannot cannot call a stored proc or any non deterministic function from a function.

Any ideas?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-24 : 08:26:08
Will the fields that needs to be cross tabbed be static?
Go to Top of Page
   

- Advertisement -