Answers for "update using variable sql"

SQL
0

t-sql update table variale

UPDATE @searchResult
SET [record_id] = r.[record_id], 
    [record_name] = r.[record_name]
FROM @searchResult SR
CROSS APPLY (
    SELECT TOP 1 *
    FROM [records]
    WHERE [record_name] LIKE [name_template]   -- Your wish, but do you really need LIKE matching??
    ORDER BY [record_id] DESC
) AS r;
Posted by: Guest on September-15-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language