question

niall5098 avatar image
niall5098 asked

Create plan guide with date time parameters

HI There, i have a poorly performing query i want to create a plan guide for. the query includes the line:

(((T8.TRANSDATE>={ts '2022-10-16 00:00:00.000'}))


in my plan guide i changed the line to:

(((T8.TRANSDATE>={ts ''@P1''})

@params = N'@P1 DATETIME2

however when i try to create the plan guide i get the following error:

Msg 241, Level 16, State 3, Line 3

Conversion failed when converting date and/or time from character string.


any idea how can get around this ?

Regards,


Niall




performance-tuningsql server 2017execution plan
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.