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)
 Create a table dynamically with undetermined cols

Author  Topic 

wskanaan
Starting Member

2 Posts

Posted - 2007-12-13 : 02:42:09
Hi everyone...

This is a topic that I found no solution for up till now. The problem for me is that I need to create a report of sales done by outlets per day with an undetermined set of outlets and an undetermined set of days. One solution I thought of was to create a table with the outlet names as columns and then populate the data by date. My problem is that I cannot find a way that allows me to create a table based on a selection of outlet names to be used as column names... does anyone here know of a solution to this issue.

Thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-12-13 : 02:47:33
maybe you can post your table DDL, sample data and how do you want the result like ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-13 : 03:06:14
If you want to show data in reports, make use of it;s cross-tab feature

Madhivanan

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

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2007-12-13 : 03:08:29
SQL Server Reporting Services - Use the Matrix option instead of a table - this does exactly that.



Duane.
Go to Top of Page
   

- Advertisement -