Query results differ in SQL Mgmt and CFQuery

executing the following query in the SQL management studio yields results, whereas this is not through cfquery ...

select distinct locationid, locationname, locationaliasname
from vwLocationsWithAlias
where 1 = 0
or (LocationName = N'the' or LocationAliasName = N'the')
or (LocationName = N'the republic' or LocationAliasName = N'the republic')

Expected results are returned from Mgmt Studio SQL, but nothing is returned from CFQuery. WTF !?

+3
source share
7 answers

Run the profiler when you send a request from Coldfusion and see if it sends what you expected.

+2
source

I assume that it has the TransactSQL Unicode ("N") indicator, which you have on string constraints. I suspect that the SQL parser in CF does not understand this.

Does CF give an error or just don't return any rows?

Datasource sql- , , DB :

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=datasources_ADV_MJS_11.html

0

, ( db):)

0

preserveSingleQuotes , .

0

, , "group by"

0

nvarchar vs varchar, N'the' "" - , where.

, , coldfusion, , .

coldfusion , .

.

0

, SSMS CFQuery "SET" ? .

, SQL Profiler, , " ". ( , , , ...) cfquery SELECT @@OPTIONS SELECT SESSIONATTRIBUTE(...).

, , - .

0

Source: https://habr.com/ru/post/1741973/


All Articles