Click here to Skip to main content
15,898,134 members

Comments by chints786 (Top 28 by date)

chints786 12-Feb-20 9:41am View    
I did try it,and that is the point I am trying to understand.

A when matched to 'Aa,B,C' must give 'N/A' in exact match column and only 'A' in the similar match column.

Another example would be

'Brush' when matched to 'Brush On';'Bru On' then the exact match would be 'N/A' but the Similar match would be 'Brush'.

Once you get a exact match of the current value we won't need to find a similar match for it.
chints786 12-Feb-20 9:17am View    
Thanks Maciej Los, however there is a gap in this.

When the current value is A we will need to check each value in the corresponding MasterList of values and check if we get the actual 'A' in it. In this case we wont get because it has 'Aa' in it. So the exact match is false or NA.

However when we traverse for Similar match kind of like clause 'A' will match with 'Aa' and hence similar match must have 'A' in it i.e. Partial match.

Similarly for the other values.

Hope you understand.
chints786 12-Feb-20 5:13am View    
Hi,

B and C is similar match because they are one of the values in the MasterListof Values column. With respect to A the MasterListValue consists of Aa hence it is not a perfect match, but it should be under Similar match and the value over there should be A.

Here is the function :-

CREATE FUNCTION [dbo].[SplitString]
(
@List NVARCHAR(MAX),
@Delimiter NVARCHAR(255)
)
RETURNS TABLE
WITH SCHEMABINDING AS
RETURN
WITH E1(N) AS ( SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1
UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1
UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1),
E2(N) AS (SELECT 1 FROM E1 a, E1 b),
E4(N) AS (SELECT 1 FROM E2 a, E2 b),
E42(N) AS (SELECT 1 FROM E4 a, E2 b),
cteTally(N) AS (SELECT 0 UNION ALL SELECT TOP (DATALENGTH(ISNULL(@List,1)))
ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) FROM E42),
cteStart(N1) AS (SELECT t.N+1 FROM cteTally t
WHERE (SUBSTRING(@List,t.N,1) = @Delimiter OR t.N = 0))
SELECT Item = SUBSTRING(@List, s.N1, ISNULL(NULLIF(CHARINDEX(@Delimiter,@List,s.N1),0)-s.N1,8000))
FROM cteStart s;
GO

cross apply with the data table I would be getting the split values of Msater column one below the other to get the exact match.
chints786 9-Dec-19 5:11am View    
Not working
chints786 5-Nov-19 6:03am View    
There is no MYSQL statement which I am using ... I am pushing data from SQL SERVER table to MYSQL table using SSIS package i.e. OLEDB Source to ADO NET Destination