Menu

The DataType mismatch on the Key field [fieldname]

0 votes

I have a view where I cast a field with a nvarchar datatype as int. When trying to add that view to be available in dbFront I get the following error.

The DataType mismatch on the Key field [%fieldname%]

Is there any way around this?

in Customization by (7.2k points)
edited by

1 Answer

0 votes
 
Best answer

The reason for the error is because dbFront assumes that it needs to create a join on that field because its name matches an existing table field.

Because you changed the datatype the join will fail.

If you don't want to join on that field then just rename it in the view. I prefer to precede formatted fields by a "v" so that I can easily identify them. You can pick whatever standard works for you.

If you want to join on that field and format it then I would create two columns in that view for the one column.

  • The original value with the original name and datatype for the join,
  • The renamed version formatted and typed as you please.

That will separate out the formatted value and allow you to use it where needed.

by (64.9k points)
selected by
Welcome to the dbFront Q&A site, where you can ask questions and receive answers from other members of the community.
 | Minimalist Answer Theme by Digitizor Media
 |
Powered by Question2Answer
...