I am having an issue with my T-SQL query here:
UPDATE a
SET a.application =
SUBSTRING(b.postdata,
NULLIF(
PATINDEX('%[A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9]-[A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9]-%',b.postdata),0),36)
FROM [Lionel1].[dbo].[CSL_Logging_STAGE] a
INNER JOIN [Lionel1].[dbo].[CSL_Logging_STAGE] b ON b.Id = a.Id
WHERE
a.application LIKE '%000%'
AND a.postdata != ''
AND a.postdata IS NOT NULL
AND a.http_method = 'post';
I have tried a handful of different castings for the GUID that is stored in the application column and I have also restructured the query to have a subquery but that makes no difference.
The error is
Msg 8169, Level 16, State 2, Line 3
Conversion failed when converting from a character string to uniqueidentifier.
Anyone point me in the right direction?
Some of the VALUES I am trying to set to application are
NULL
0dab3646-a4ed-4b63-9441-11e27fa36df8
f6a5c360-635a-48e0-bf71-76ef0b865441