Book a Demo

Author Topic: SQL: package name like object alias + string?  (Read 9241 times)

Hurra

  • EA User
  • **
  • Posts: 184
  • Karma: +0/-0
    • View Profile
    • Find me at LinkedIn!
SQL: package name like object alias + string?
« on: September 27, 2018, 07:16:59 pm »
Hello!

I've run in to some problems with a SQL query.

I have defined some roles to an OperationalPerformer (UAF) in a package named x Organisation where x is the alias of the element OperationalPerformer.

I find all the elements I need with

Code: [Select]
select o.ea_guid as CLASSGUID, o.Object_Type as CLASSTYPE, o.Name, p.Name as PName
from t_object o, t_package p
where p.Package_ID = o.Package_ID and p.Name = "x Organisation"

I want to make this more generic for documentation. Therefore my thought was I add the element of interest and use its alias, something like:

Code: [Select]
select o.ea_guid as CLASSGUID, o.Object_Type as CLASSTYPE, o.Name, p.Name as PName, o2.Alias
from t_object o, t_package p, t_object o2
where p.Package_ID = o.Package_ID and o2.Object_ID = 8451 and p.Name = o2.Alias + ' Organisation'
and setting the o2.Object_ID to #OBJECTID#.

However I can't get this to work. I tried all kinds of combinations with parenthesis, brackets, '', "", wildcards (using like).

I guess this has a simple solution, but my SQL skills are not the best.

Thank you!
always learning!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: SQL: package name like object alias + string?
« Reply #1 on: September 27, 2018, 07:43:01 pm »
I'm also no SQL guru but string operations are likely to b RDBMS dependent. Google for something like "sql server string concat" which gives you plenty of results.

q.

Hurra

  • EA User
  • **
  • Posts: 184
  • Karma: +0/-0
    • View Profile
    • Find me at LinkedIn!
Re: SQL: package name like object alias + string?
« Reply #2 on: September 27, 2018, 09:57:59 pm »
I'm also no SQL guru but string operations are likely to b RDBMS dependent. Google for something like "sql server string concat" which gives you plenty of results.

q.

Thank you!
always learning!