Skip to main content
Solved

incorrect syntax error in automatically generated code


Forum|alt.badge.img+6

I ran into an error when I tried to build my database.
It's not the first time I ran into errors during execution of the sourcecode but this one is new for me:

 

An unknown error occurred while executing '
create nonclustered index "so_slaughter_registration"
on "slaughter_registration"
(
   "slaughter_date" desc, 
   "day_sequence_number" desc
   "slaughter_registration_id" desc, 
)
'. 

Error: 'Incorrect syntax near 'slaughter_registration_id'.'.

I can clearly see the incorrect syntax as there is no comma after the middle desc… And there is a rogue comma after the last desc...
But I'm pretty sure this piece of code is generated by TW from the indexes tab on datatable->Tables

How can I influence this?

I think I see where it happens but I cannot edit it:
 

I fixed it by completely removing the index and recreate it which also resulted in correct priorities of the columns:
 

 

Best answer by Mark_Plaggenborg

@Alban_T Seeing it starting with “so_” that means it is from a sorting order done on the table.

Check the setting there starting at menu item “User interface” → “Subject” →  → “Data” → “Sort".

If I remember correctly this issue had something to do with a duplicate “Sort no.” or a column having the same order no in the data model. I hope this will guide you towards a solution.

View original
Did this topic help you find an answer to your question?
This topic has been closed for replies.

2 replies

@Alban_T Seeing it starting with “so_” that means it is from a sorting order done on the table.

Check the setting there starting at menu item “User interface” → “Subject” →  → “Data” → “Sort".

If I remember correctly this issue had something to do with a duplicate “Sort no.” or a column having the same order no in the data model. I hope this will guide you towards a solution.


Forum|alt.badge.img+6
  • Author
  • Hero
  • 86 replies
  • August 20, 2024
Mark_Plaggenborg wrote:

@Alban_T Seeing it starting with “so_” that means it is from a sorting order done on the table.

Check the setting there starting at menu item “User interface” → “Subject” →  → “Data” → “Sort".

If I remember correctly this issue had something to do with a duplicate “Sort no.” or a column having the same order no in the data model. I hope this will guide you towards a solution.

ahhh should have known that that was what so_ stood for :)
I did look at the sorting but slaughter_registration_id isn’t in the default sort.
But maybe it was before, looking at the modified by column the slaughter_registration_id was the only one that was manually added as the other two use the apppool user suggesting that it was something automated.

As mentioned before, I was able to fix it by adding the index manually and removing the other one.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings