Before I update I want to test whether certain conditions are true but I get the following error.
Why?
Thanks
[error]
Server: Msg 170, Level 15, State 1, Line 5
Line 5: Incorrect syntax near '>'.
Server: Msg 156, Level 15, State 1, Line 20
Incorrect syntax near the keyword 'as'.
[/error]
Exams Passed: 70-152, 70-175, 70-176, 70-100
Why?
Thanks
[error]
Server: Msg 170, Level 15, State 1, Line 5
Line 5: Incorrect syntax near '>'.
Server: Msg 156, Level 15, State 1, Line 20
Incorrect syntax near the keyword 'as'.
[/error]
Code:
UPDATE W
SET Referrer=
CASE Referrer
WHEN CHARINDEX('[URL unfurl="true"]http://',[/URL] Y.PR) > 0 THEN REPLACE(Y.PR, '[URL unfurl="true"]http://',[/URL] '')
WHEN CHARINDEX('[URL unfurl="true"]http://www.',[/URL] Y.PR) > 0 THEN REPLACE(Y.PR, '[URL unfurl="true"]http://www.',[/URL] '')
ELSE Y.PR
END
FROM WebLog W
INNER JOIN
(SELECT
IP,
(Referrer) as PR
FROM WebLog l
WHERE [Date] =
(SELECT Max([Date])
FROM WebLog
WHERE IP=l.IP)) as Y
ON W.IP=Y.IP