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)
 UNPIVOT with dynamic column names within function

Author  Topic 

nemesis52
Starting Member

1 Post

Posted - 2010-12-23 : 01:03:53
Hi,

I have a problem and I hope you can help me. I need to use UNPIVOT inside a user defined function. The problem is, my column list should be dynamic. I tried to use EXEC (@SQL) to build my SELECT query and I found out it is impossible to use EXEC inside function so I don't know how I can make my query. I appreciate for you helps.

Thanks

Sachin.Nand

2937 Posts

Posted - 2010-12-23 : 01:45:08
Post some sample data and the expected output.

PBUH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-12-23 : 03:14:59
Use Stored procedure instead of function

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -