Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi,I'm trying to do the following:I have a column in a table that is a comma seperated values for a search criteria on another table.I've created a split function that selects that column and seperates it into a list.I now need to query the other table and select from a column all the items that are LIKE each of the list in the results from the split.How would you do that?Thanks,KerenMy query looks as follows:SELECT * from tbl_RTGS_OSBSBWHEREPayment_Details in ***** PROBLEM IS HERE **** (select String from Split((SELECT Product_Details.MultyLineField1FROM Product_Details,Sub_Customer_To_Productswhere Sub_Customer_To_Products.Product_Detail_Id = Product_Details.Product_Detail_Id AND Product_Type_Id = @ProductType AND Sub_Customer_Id = @SubCustomer) , ','))
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2008-08-25 : 00:04:58
cant you just use like this?
SELECT *FROM tbl_RTGS_OSBSB t1INNER JOIN Sub_Customer_To_Products t2ON ','+ CAST(t1.Product_Detail_Id AS varchar(50))+',' LIKE '%,'+CAST(t2.Product_Detail_Id AS varchar(50))+',%'