You could create one table that will store dynamic columns and another to store the dynamic columns data.
Then if you're using MSSQL 2005+ than you can use SQL Pivots to extract the data dynamically.. if your using anything less than MSSQL 2005 than you could use dynamic SQL and build a temp table. Pivots http://www.sqlprof.com/blogs/sqldev/archive/2008/04/12/pivots-with-dynamic-c olumns-in-sql-server-2005-2008.aspx Regards, Paul Alkema -----Original Message----- From: Brian Thornton [mailto:vegasthorn...@gmail.com] Sent: Thursday, April 15, 2010 5:21 AM To: cf-talk Subject: Re: Dynamic SQL Column Names Or go runa query on the table with 1 record using a select * and loop through the columnlist returned. On Wed, Apr 14, 2010 at 8:39 PM, Doug Ford <doug.e.f...@gmail.com> wrote: > > Hi Folks - > > I am wracking my brain trying to figure out how to get the results I am looking for. > > Here's the background - > > I am dealing with dynamic environment allowing losers, I mean users, to enter in field names. This is a business product so anything is possible. > > When a user of the product creates the columns, they have no knowledge of coldfusion or sql, so if a person enters in "VIN #" as a piece of information they wish to capture, "VIN #" becomes a column header. > > Now then, on any given random form my system would be creating, I won't know how many fields or their names. > > If a person creates 5 or 500 fields, I have no clue, and I won't know what column names they could ultimately create. > > I have been toying with getColumnList() to display the column titles, but how would I get the actual data out of it? > > I have tried using evaluate on the field names, but when it comes across VIN #, the system blows up. > > Any and info is appreciated. > > Thanks, > > Doug > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332904 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm