IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

CAST in where clause Options · View
Presente
Posted: Tuesday, May 22, 2012 11:23:07 AM
Rank: Newbie

Joined: 5/22/2012
Posts: 5
Our mapping maps from SQL to xml. (we have SQL server 2008).
DB columns typically have type of 'nvarchar[n]' (n value vary) and schema corresponding attributes are strings.
Most of the generated queries contain 'where' clause that looks like:

WHERE (CAST(? AS nvarchar(max))) = [key1] and ...

Such queries are very slow, because due to CAST indexes are not used.

When I manually do 'replace' in the generated code to 'Where ? = [key1]', the same query runs 100 times faster.

Altering generated code manually is not a good practice. Is there a way to config MapForce NOT to create queries with CAST in the first place?

(I unchecked 'Cast Values to target types', but it didn't help)

Thanks,

Ofer

vlad
Posted: Tuesday, May 22, 2012 1:27:05 PM
Rank: Advanced Member

Joined: 12/13/2005
Posts: 2,856
Location: Mauritius
Are you using the same driver to connect MapForce to your database and to execute this code afterwards?
wonky
Posted: Thursday, December 17, 2015 12:46:44 PM
Rank: Member

Joined: 11/23/2015
Posts: 18
Location: Trenton, NJ
Bump: The OP's question about "not generating CAST in the first place"? There seems to be no way to suppress CASTs in MapForce 2016 Enterprise, and the advice for other component types: select "Properties", and then uncheck the "Cast values to target types" doesn't seem to work for databases components.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.