Since awk has limitations of the size of input it can take in one line try the following:
cat sql.txt |
perl -e 'print (split (/#/,$_))[1]'
split works like the FS of awk, but the field count starts from 0
if you need a newline after the output use:
cat sql.txt |
perl -e 'print (split (/#/,$_))[1] . "\n"'