Forum Replies Created

Viewing 15 posts - 2,791 through 2,805 (of 10,144 total)

  • RE: date

    -- day 0 ('19000101') is a monday

    SELECT DATENAME(dw,cast('19000101' as date)) -- monday

    SELECT DATEDIFF(day,0,GETDATE()) -- 41952 (tuesday 11th November)

    SELECT 41952 % 7 -- = 1 for today (tuesday)

    SELECT 41951 % 7...

  • RE: Query to find "games behind" in a sports table

    Drop GameYear, GameMonth and GameDay if they are derived from GameDate, and calculate them in your queries instead.

    What are TxtYear and NumYear? Year (with century) is 4 characters, CHAR(4). Don't...

  • RE: Incorrect syntax near the keyword 'ELSE'

    I find it easier to use ISNULL:

    SELECT (T0.Rate * SUM(T0.LineTotal) - (T0.DiscPrcnt / 100) + ISNULL(T3.LineTotal,0) AS 'Total NATIVE'

    😉

  • RE: Levenshtein UDF performance 'tuning' advise needed

    Okay, think I get it. Does this match your output requirement?

    SELECT

    t1.*,

    oa.*

    FROM #Vergelijkingstabel_1 t1

    OUTER APPLY (

    SELECT t3.*, x.[Score %]

    FROM #Vergelijkingstabel_2 t3

    CROSS APPLY dbo.IF_Levenshtein02 (t3.Omschrijving, t1.Omschrijving) x

    WHERE NOT...

  • RE: Levenshtein UDF performance 'tuning' advise needed

    Are you expecting two result sets? If so, here's the second:

    -- Using UDF

    SELECT

    t1.*,

    t3.*

    FROM #Vergelijkingstabel_1 t1

    OUTER APPLY (

    SELECT t2.*, x.percentage

    FROM #Vergelijkingstabel_2 t2

    CROSS APPLY (SELECT percentage = dbo.fn_Levenshtein (t1.Omschrijving, t2.Omschrijving,...

  • RE: Are the posted questions getting worse?

    Eirikur Eiriksson (11/8/2014)


    Just got an "interesting" email via SSC, Steve are you expanding the "service"?

    😎

    She's loaded too! Go for it, Eirikur!

    By PM: "Assalamu alaykum

    With due respect and humility I write...

  • RE: Levenshtein UDF performance 'tuning' advise needed

    Hi Mike

    Working without sample data always comes with the risk of syntax errors - can you prepare some please?

  • RE: Levenshtein UDF performance 'tuning' advise needed

    -- Yes, you are still missing the point I'm trying to make.

    -- Also, your strange query is equivalent to this

    SELECT

    T1.*,

    T3.*,

    master.dbo.fn_Levenshtein(T1.Omschrijving, T3.Omschrijving, 80) AS percentage

    FROM Vergelijkingstabel_1 AS...

  • RE: Levenshtein UDF performance 'tuning' advise needed

    mike--p (11/7/2014)


    ...

    Yes my join was correct, here the results from your query. As you can see it scans through all the columns (plus one too much highligthed in red). I...

  • RE: Levenshtein UDF performance 'tuning' advise needed

    Are you sure your join is correct?

    DROP TABLE #Table1

    CREATE TABLE #Table1 (Bestelnummer INT, Omschrijving VARCHAR(20))

    INSERT INTO #Table1 (Bestelnummer, Omschrijving)

    VALUES (101,'ABN101'),(102,'ZBN'),(103,'KDN154'),(104,'ADN235'),(105,'QND999'),(110,'QQQ313'),(112,'ABL513')

    -- 7 rows

    DROP TABLE #Table2

    CREATE TABLE #Table2 (Bestelnummer INT, Omschrijving VARCHAR(20))

    INSERT...

  • RE: Levenshtein UDF performance 'tuning' advise needed

    mike--p (11/7/2014)


    ChrisM@Work (11/6/2014)


    SELECT T1.*, T2.*

    FROM (SELECT rn = ROW_NUMBER() OVER(ORDER BY something) FROM table_1) AS T1

    INNER JOIN (SELECT rn = ROW_NUMBER() OVER(ORDER BY something) FROM table_2) AS T2

    ON...

  • RE: Levenshtein UDF performance 'tuning' advise needed

    SELECT T1.*, T2.*

    FROM (SELECT rn = ROW_NUMBER() OVER(ORDER BY something) FROM table_1) AS T1

    INNER JOIN (SELECT rn = ROW_NUMBER() OVER(ORDER BY something) FROM table_2) AS T2

    ON T1.rn <...

  • RE: Levenshtein UDF performance 'tuning' advise needed

    Try this:

    SELECT T1.*, T2.*

    FROM table_1 AS T1

    INNER JOIN table_2 AS T2

    ON T1.[column_T1] < T2.[column_T2]

    WHERE dbo.Levenshtein(T1.[column_T1], T2_2.[column_T2]) > percentage

  • RE: Levenshtein UDF performance 'tuning' advise needed

    Sure. That's probably easiest if you post your existing query to use as a model. You may have to post some sample data too, let's see how we get on...

  • RE: Levenshtein UDF performance 'tuning' advise needed

    mike--p (11/6/2014)


    I tried the function you posted in that thread, still have the same results. As you stated you have to compare all the rows from both tables with eachother....

Viewing 15 posts - 2,791 through 2,805 (of 10,144 total)