## Spilt List Function

 Author Message eagb Grasshopper Group: General Forum Members Points: 20 Visits: 95 This must be much simplier than I'm making it...I have an unique idenifier for a person, and a space delimited field containing grades they teach, since they could teach more than one grade I'm looking to have their unique idenifier and a single grade taught. I have a split list function but how do I do this...SELECT ID, (SELECT * FROM dbo.udfSplitList(Grades,' ')FROM TableAI know this is the wrong way and I get errors, any guidance would be great!Thanks! Lynn Pettis SSC Guru Group: General Forum Members Points: 94731 Visits: 38956 eagb (2/14/2013)This must be much simplier than I'm making it...I have an unique idenifier for a person, and a space delimited field containing grades they teach, since they could teach more than one grade I'm looking to have their unique idenifier and a single grade taught. I have a split list function but how do I do this...SELECT ID, (SELECT * FROM dbo.udfSplitList(Grades,' ')FROM TableAI know this is the wrong way and I get errors, any guidance would be great!Thanks!First, you really should provide the details of the error(s) you are getting. It really doesn't tell us anything when all you say is "I get errors."Second, it looks like dbo.udfSplitList is a table valued function. This is how you should be using it in this case:`SELECT a.ID, sl.* -- not sure what the column or columns returned are or I would list them.FROM TableA a CROSS APPLY SELECT * FROM dbo.udfSplitList(Grades,' ') sl` Lynn PettisFor better assistance in answering your questions, click hereFor tips to get better help with Performance Problems, click hereFor Running Totals and its variations, click here or when working with partitioned tablesFor more about Tally Tables, click hereFor more about Cross Tabs and Pivots, click here and hereManaging Transaction LogsSQL Musings from the Desert Fountain Valley SQL (My Mirror Blog) eagb Grasshopper Group: General Forum Members Points: 20 Visits: 95 Thank you that worked perfectly! Jeff Moden SSC Guru Group: General Forum Members Points: 214752 Visits: 41979 eagb (2/14/2013)Thank you that worked perfectly!Any chance of us getting a peek at your split function? --Jeff ModenRBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair Helpful Links:How to post code problemsHow to post performance problemsForum FAQs