I have the following SQL Query, where the field ta.GeoAreas contains comma separated values (reason is it needs to support Sharepoint, at least that is my thought).
As of now the query creates a row for each TiedAgent. I would like to extend the table to include a row for every TiedAgent and Zipcode connection. So for instance, if the tied agent ABC has GeoAreas "1111,2222,3333", instead of the row
[Center] / "ABC" / [MeetingTypes] / "1111,2222,3333"
I would like three rows to be created like this:
[Center] / "ABC" / [MeetingTypes] / "1111"
[Center] / "ABC" / [MeetingTypes] / "2222"
[Center] / "ABC" / [MeetingTypes] / "3333"
Please help me on that one?
SELECT c.Name as Center
,ta.MeetingTypes as Types
,ta.GeoAreas as Zips
FROM [mbw-db].[dbo].[TiedAgent] ta
JOIN [mbw-db].[dbo].[Center] c
ON ta.centerID = c.ID
WHERE ta.Status = 'Aktiv' AND NOT ta.Initials = '_'
The Server is running SQL Server 2008 - it is not possible to create UDF's, at least not on serverside - and as I've figured, this is necessary in order to use them?
The query will have to be used in an excel file, if this makes any difference...
Thanks in advance