Ben
Ben

Reputation: 11

How does Forced Parameterization impact queries when using SET options such as quoted identifier?

When using Simple Parameterization in the AdventureWorks database, you can execute the following query:

USE [AdventureWorks2022]
GO

SET QUOTED_IDENTIFIER OFF

SELECT "True" FROM Person.Person WHERE FirstName = "John"

SET QUOTED_IDENTIFIER ON

However, when you enable Forced Parameterization, this same query fails with:

Invalid column name 'True'.

If you remove the the SET QUOTED_IDENTIFIER ON at the end it succeeds, or if you add a GO after the SELECT, it also succeeds.

Is this something to do with how Forced Parameterization works? Just looking for an explanation so I can better understand it.

Upvotes: 1

Views: 60

Answers (0)

Related Questions