> Why do u have to do the below... u can contruct the SQL in
> CF and just pass
> it.

> select * from TableName where 1=0
> This gives you Query.ColumnList.. now.. all you got to do
> is loop through
> the Query.ColumnList and Dynamically build the CASE
> Statement for the Query
> <cfquery ...
> declare @fields varchar(200)
> set @fields='';
> select
> <cfloop index="x" list="#Query.ColumnList#" delimiter=",">
> @fields=@fields + CASE WHEN #x# IS NULL THEN '#x#' END,
> </cfloop>
> from TableName
> select @fields as ColumnName
> </cfquery>

> Havent tested this.. but something of this sort might be
> easier.

> Joe

It encapsulates the function so that if she needs to use it elsewhere in the
app or on another table, it's faster and easier to implement than cutting
and pasting ... more portable, etc... I suspect it's also more efficient and
generally speaking I dislike using multiple t-sql statements in cfqueries...
although this last is probably just a personal prejudice -- it just looks
bad to me...

Isaac
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to