Wouter
8 years agoNew Contributor
Solved
SQL where in groovy script
Hi,
The following groovy script does nothing:
def cmd = /sqlcmd -S 127.0.0.1\MSSQLSERVER -d LocalDevelop10DB -Q "DELETE FROM T_TimeRegistration WHERE TimeRegLineNr > 36"/ cmd.execute()
While this groovy script works perfectly:
def cmd = /sqlcmd -S 127.0.0.1\MSSQLSERVER -d LocalDevelop10DB -Q "DELETE FROM T_TimeRegistration WHERE TimeRegLineNr = 37"/ cmd.execute()
I want to use the (effects of) first script. It seems the '>' character is somehow not supported, I tried escaping it but no joy. What am I missing, can someone help?
Thanks
Do you need to fire off the query within a Groovy script? Seems like a lot to manage when ReadyAPI has a built-in JDBC request test step to handle all of this. I've had success building my query in a Groovy script then passing this string to the query of a JDBC request step.