DECLARE @sql as varchar(5000) = 'SELECT E.LastName + '', '' + E.FirstName AS Name, SM.MetricText, PRR.RatingFROMEmployee E,SkillsMetric SM,PerformaceReviewHistory PRH,PerformanceReviewRating PRRWHEREE.ID IN (' + @pEmployeeIds + ') ANDE.ID = PRH.EmployeeID ANDSM.ID = PRR.SkillsMetricID ANDPRH.ID = PRR.PerformanceID '
DECLARE @ids VARCHAR(100), @sql NVARCHAR(1000)SET @ids = '4,5,6'SET @sql = 'Select * from sys.objects as o where o.object_Id in (' + @ids + ')'EXEC (@sql)
SELECT * FROM dbo.Split('12|-|34|-|56|-|78','|-|');
Id Data1 122 |343 |564 |78
Sorry folks... the code I posted here previously works fine for commas but has a case problem with letters. I'll replace the code here with the fix as soon as I can.