Hi,
Schleifen kann man mit einem Cursor anhandeln. So ungefähr... :
DECLARE C1 CURSOR for
SELECT SnmpColorant , sValue From dbo.ACCSNMPHISTORY
WHERE (Name LIKE '%Toner%' OR Name LIKE '%Kassette%') AND (DeviceId = ad.Id) AND (CONVERT(date, TimeUTC) = CONVERT(date, GETDATE()
OPEN C1
FETCH NEXT FROM C1 INTO @SnmpColorant , @value
WHILE @@FETCH_STATUS = 0
BEGIN
@spalten = @spalten + @value + ' as ' + @SnmpColorant + ','
END
lg apfelsine