Hi, what i would like todo is put a multiple values result into a Table Variable and reuse it few times in the code (in the select, where, etc..)
My problems are :
- Can't use the XMLPATH method into the Insert into VAR Table
- Where i can call my insert to the var table in the code, cause i need to know the field RequestId, witch is too soon in the following code.....
Here's my code :
DECLARE @RequestApplications TABLE
INSERT INTO @RequestApplications (Descriptions) ( SELECT ApplicationName + ' '
FROM ApplicationsAccessRequest AAR
WHERE AAR.RequestID = RequestID
FOR XML PATH('')
-- Result will be "VPN, HS-VPN, WORD, VISIO, "
SELECT R.RequestId, (SELECT TOP 1 Descriptions FROM RequestApplications ) as Apps
WHERE (SELECT TOP 1 Descriptions FROM RequestApplications ) LIKE '%VPN%'
Anyone know how to resolve this ?
Thanks a lot for you help and excuse my english....