I would like to grep all files except some file types?
If you have GNU grep
you can use the --exclude=GLOB
option, like
grep -r --exclude='*.sql' pattern dir/
This will do that for you and exclude .sql and .txt files:
find /some/dir -type f ! -name '*\.sql' ! -name '*.txt' -print0 | xargs -0 grep 'foobar'
However it sounds like ack would be a far better tool for what you're trying to do:
ack -a --nosql 'foobar' /some/dir