Hi there,
Our business is having a problem when using a queryEntity in Appian for a certain field. It converts that field to an NVARCHAR(4000) (I'm assuming because it's a text field) even though our Database and Data Type have it listed as VARCHAR(50). In SQL Server, when comparing an NVARCHAR to a VARCHAR, it causes an implicit conversion of all data in the VARCHAR column which is a big performance hit for us.
Is there any way to make sure that the parameter uses VARCHAR(50) instead of NVARCHAR(4000)?Thank you
Discussion posts and replies are publicly visible
A bit of a guess here but it's likely an issue that can be seen/resolved in the XSD for the data type you are using. When you've got the data type open go to the cog in the top left corner then download XSD. Can you post the full <element> tag of the field that is giving you an issue? See below for an example.
<xsd:element name="error" nillable="true" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(length=255)</xsd:appinfo> </xsd:annotation> </xsd:element>
I checked that already but here's the XSD for the Element.
<xsd:element name="UniquePatientId" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="UniquePatientId", nullable=false, columnDefinition="VARCHAR(50)")</xsd:appinfo> </xsd:annotation> </xsd:element>
Thanks. Where specifically do you see that the data type is NVARCHAR(4000)?
When I look at our code in Azure Portal, I can see that the query has turned into this SQL:
I feel like I'm missing something. What query turned into SQL? Now that we're in Azure Portal (new info here!) this introduces another place where a conversion could occur. Not saying it is Azure Portal but just that it's another place where it could be.
Can you confirm if nvarchar is in the database (not using Azure Portal)? I feel the XSD in Appian has mostly likely eliminated Appian as the issue but it would be good to confirm what the actual DB says. Your earlier comments suggest it also shows varchar(50) but I'm not 100% sure.
Also, if there are any views involved in this set up it would be good to confirm those too.