Created
May 11, 2010 22:01
-
-
Save DoubleBrotherProgrammer/397942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use AdventureWorks | |
-- fill up temp table 1 ( [Schema], [Event] ) | |
SELECT DISTINCT [Schema], [Event] | |
INTO #tempTbl1 | |
FROM DatabaseLog | |
ORDER BY [Schema], [Event] | |
-- create delimited list | |
SELECT [Schema], | |
Events = STUFF( | |
( | |
SELECT ',' + [Event] | |
FROM #tempTbl1 mp2 | |
WHERE mp2.[Schema] = mp1.[Schema] | |
FOR XML PATH('') | |
), 1, 1, '' ) | |
FROM #tempTbl1 mp1 | |
GROUP BY mp1.[Schema] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment