Question:
How to do this:
DECLARE @StateUID varchar(max)
SET @StateUID = 'E8812237-2F3B-445E-8EEF-020E0B6F6A53, 66E57225-642F-45B5-8E5D-070F2D1CF99D, 751C615B-EB9C-4D25-955D-0E0EB3CD05A2'
SELECT StateFullName, StateAbbrv, StateID
FROM tblStates
WHERE StateUID IN ( @StateID )
Doing string.join as shown below doesn't help as well:
SET @StateUID = '''E8812237-2F3B-445E-8EEF-020E0B6F6A53'', ''66E57225-642F-45B5-8E5D-070F2D1CF99D'', ''751C615B-EB9C-4D25-955D-0E0EB3CD05A2'''
I've now moved it into dynamic SQL, where it works.
But this is extremely error-prone, annoying and time-consuming, so I wanted to ask whether there is any non-insane way of doing this (without temp tables, functions etc.) ?