mercredi 14 octobre 2015

SQL 2005 query uses ? which doesn't work in SQL 2012

I'm working on an application which queries live data on an SQL server. The user enters a name within '% %' marks to search. Ie. if the user was to search for the owner of a property such as Noble, they would enter %noble%. We recently upgraded both the application and the SQL server that stores the data from SQL 2005 to SQL 2012.

The existing query and the new query are identical:

SELECT aurtvalm.pcl_num 

FROM aurtvalm 
INNER JOIN rtpostal ON aurtvalm.ass_num = rtpostal.ass_num

WHERE rtpostal.fmt_nm2 Like ?

In the old version, the above query produces 16 results. The exact same query in 2012 version produces an error:

Incorrect Syntax near '?'

Has the use of the ? symbol changed since SQL 2005?

Aucun commentaire:

Enregistrer un commentaire