1

I have a table with a column named "idEntity", if i run this query:

select idEntity from algo.AUDITORIA ;

in oracle, there's no problem and the query runs,

but in SqlServer I'm getting:

Incorrect syntax near the keyword 'from'.

it seams that IDENTITY is a reserved word, and instead of refereng to the column it thinks its a function,

and if i surround idEntity with [ ] the query works:

select [idEntity] from algo.AUDITORIA ; -- this works!

my main problem is that I'm using hibernate, is there an option to tell to hibernate to force the [ ] on every name of the table columns?

Alfredo M
  • 538
  • 2
  • 6
  • 24
  • 3
    The best option would be to NOT use reserved words for column names. Identity is a reserved word. Choose a better column name. – Sean Lange Jul 03 '18 at 21:32
  • Possible duplicate of [Creating field with reserved word name with JPA](https://stackoverflow.com/questions/2224503/creating-field-with-reserved-word-name-with-jpa) – Tanner Jul 03 '18 at 21:36
  • The answer on the duplicate may help, but as @SeanLange says, it's better not to use reserved words for column names. – Tanner Jul 03 '18 at 21:38
  • with hibernate.globally_quoted_identifiers=true , all the mapings in the beans HAVE to match case with the database – Alfredo M Jul 03 '18 at 21:47
  • Possible duplicate of [Inserting multiple rows in a single SQL query?](https://stackoverflow.com/questions/452859/inserting-multiple-rows-in-a-single-sql-query) – Dan Aug 04 '18 at 17:53

0 Answers0