Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a query that is generating further queries, things like this:

select 'exec uspd_thing "'||name||'"'
from sometable

Which produces this :

exec uspd_thing "name1"
exec uspd_thing "name2"

But isql requires a 'go' statement after each statement.

There is an option to change the command terminator (-c) but the new terminator still needs to appear on the same line.

Any suggestions/tips on how to do this kind of thing... I guess I could post-process the results to add the 'go' lines...

Thanks, Chris

share|improve this question
up vote 3 down vote accepted

AFAIK ISQL doesn't always need a go (or a ";", which will equally serve as a terminator. T-SQL commands may be allocated on consecutive lines without separator, the parser will handle that.

R. Pods

share|improve this answer

Try adding the go in the result:

select 'exec uspd_thing "'||name||'"'||char(10)||'go'||char(10)
from sometable
share|improve this answer

The post-process option via awk is as follows:

awk '{print $0}; /exec / {print "go"}'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.