0

How do I get unbuffered output when using sqlcmd

Lets say I have a file:

while (1=1)
begin
        print '------------------------------------------------------'
        select NOW=getdate(), DB=db_name()

        waitfor delay '00:00:01'
end
go

And I execute the above file with:

sqlcmd -Usa -S srvName -P passwd -i xxx.sql

I would expect ouput every second! But it takes about a minute or two before anything is returned

So if I want to "report" anything in the SQL batch I can't tdo that???

Is there anyway I can change this behaviour?

NOTE 1: The OS I'll be using is Linux, but when testing, it was the same behaviour on both platforms
NOTE 2: I'm used to Sybase and isql, which is "unbuffered"

0 Answers0