question

yexioamu avatar image
0 Likes"
yexioamu asked yexioamu commented

Does table sql queries have a function like substr?

I need to extract the second letter in a column of a table for a complex sql, the substr function and substring function is not work, what can i do for it?

FlexSim 21.2.4
sql queries
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered yexioamu commented

Dot-syntax and methods/commands using square brackets don't work in queries. You can setup user commands though that return the wanted value.

In this case you can also use the deprecated command "stringpart()".

Table.query("SELECT stringpart([Col], 1, 1) FROM GlobalTable1").cloneTo(Table("GlobalTable2"));
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

yexioamu avatar image yexioamu commented ·
thank you! it works, but it has a point to note, the second parameters, the num start, countsing starts from zero.
0 Likes 0 ·