I am very new to SQL query so, sorry If I miss basic details. Here is the scenario:
I have to search the user email Id inside the column.
the column contains values like
abc@company.com;xyz@company.com;test@company.com;
Now I got the user email id from query:
DECLARE @emailid AS VARCHAR(50)
SELECT @emailid = emailId FROM dbo.tblUser WHERE userName = 'abc' AND projectId ='P1456'
I also replaced the semicolon with a comma like:
COLUMNNAME IN (REPLACE(@emailid,';' ,','))
Now I got the string like abc@company.com,xyz@company.com,test@company.com,
But IN clause treat it as a single string, So how to append inverted commas in each email ids like below to help IN clause to search?
'abc@company.com','xyz@company.com','test@company.com',