Book a Demo

Author Topic: SQL search fails on database server  (Read 4262 times)

PeteC

  • EA User
  • **
  • Posts: 91
  • Karma: +1/-0
    • View Profile
SQL search fails on database server
« on: March 03, 2021, 11:15:15 pm »
I have always used EAP/EAPX files for models. We are looking to use a database server and searches that previously worked are failing "Invalid column name 'Requirement'". Strangely Requirement is not a column name but a test value.

I can't find anything in the guidance on searches that mentions differences, although I vaguely recall seeing something on these forums (but can't find that either).

What are the differences between file based models and those on an SQL server that cause issues? How can I change searches so that they work on either file or database hosted models?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: SQL search fails on database server
« Reply #1 on: March 03, 2021, 11:52:02 pm »
You should look for differences in SQL syntax between MS Access and SQL Server.

The error you mentioned is probably due to the fact that MS Access allows the use of double quotes as text indicator (standard SQL allows only single quotes)
So if you write something like

Where t_object.ObjectType = "Requirement"

You will get such an error. Change that to

Where t_object.ObjectType = 'Requirement'

and it will work in both cases.

Try to stay as close as possible to the ANSI SQL standard, and you will have the least problem.
If you can't avoid it, there are macro's you can use to specify which part of the query to use for which database type.

Geert

PeteC

  • EA User
  • **
  • Posts: 91
  • Karma: +1/-0
    • View Profile
Re: SQL search fails on database server
« Reply #2 on: March 04, 2021, 12:23:54 am »
Thanks Geert - double quote is the issue. Where do I find the macros you mention in case I need them later?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: SQL search fails on database server
« Reply #3 on: March 04, 2021, 12:30:48 am »
Thanks Geert - double quote is the issue. Where do I find the macros you mention in case I need them later?
The manual :)

https://sparxsystems.com/enterprise_architect_user_guide/15.2/navigation/creating_filters.html

Geert