I am reading a sql table through a Sql statement, meanwhile i am also using a substring. Since the Substring is like virtual i am not writing in the database. How am i able to set this read substring using a setter in groovy using sql.eachrow.
I have tried setFinishingTime(row.FinishingTime)
This is in my groovy code.
sql.eachRow('select * from [Database].[dbo].[table] order by FinishingTime')
{ row ->
---
machine.setFinishingTime(row.FinishingTime)
}
In sql query i have a code.
substring([FinishingTime], charindex(' ', [FinishingTime]) + 1, len([FinishingTime])).
I want to set in FinishingTime the substring of the column finishingtime. How can i achieve that, It works in sql management studio but how do i use the same in groovy through sql.eachRow.