All great ideas/solutions, thanks everyone. I think i'm going to use a table valued function. Function returns the field as a table, which can then be counted.
If anyone's interested i can post the code for the table valued function that splits the CSV field into a table variable, and then the syntax to execute it. On Fri, Aug 5, 2011 at 10:41 AM, Jerry Barnes <[email protected]> wrote: > > In the Declaration, @RetCount should have been an integer. That is: > > DECLARE @iPos int, @iNext int, @iRetCount int, @iValLen int > > > select > dbo.f_itemCount('A,V,C,P,AA,PP,R,RT,L,Z,Z,Z','A')as A_Count, > dbo.f_itemCount('A,V,C,P,AA,PP,R,RT,L,Z,Z,Z','V')as V_Count, > dbo.f_itemCount('A,V,C,P,AA,PP,R,RT,L,Z,Z,Z','C')as C_Count, > dbo.f_itemCount('A,V,C,P,AA,PP,R,RT,L,Z,Z,Z','AA')as AA_Count, > dbo.f_itemCount('A,V,C,P,AA,PP,R,RT,L,Z,Z,Z','PP')as PP_Count, > dbo.f_itemCount('A,V,C,P,AA,PP,R,RT,L,Z,Z,Z','R')as R_Count, > dbo.f_itemCount('A,V,C,P,AA,PP,R,RT,L,Z,Z,Z','RT')as RT_Count, > dbo.f_itemCount('A,V,C,P,AA,PP,R,RT,L,Z,Z,Z','L')as L_Count, > dbo.f_itemCount('A,V,C,P,AA,PP,R,RT,L,Z,Z,Z','Z')as Z_Count > > > Returns > 1,1,1,1,1,1,1,1,3 > > J > > - > > Ninety percent of politicians give the other ten percent a bad reputation. > - > Henry Kissinger > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:341291 Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-community/unsubscribe.cfm
