r/SQL • • Aug 12 '26

Discussion Shebang equivalent for SQL dialects?

When writing shell scripts it's common to have on line 1

#!/bin/bash

which would differentiate it from

#!/bin/sh

I have a lot of SQL saved in text files — all .sql extension — for processing CSVs at work; these are all in-memory instances that ingest CSVs and output CSVs. For many years I only used SQLite so I only had to remember sqlite3 < query.sql.

Recently, I started writing for DuckDB as well, initially only because of its ability to load JSON/CSV from a URL; I'm also quickly seeing how advantageous its extra functions are.

Is there any shebang-style line that I can start my files with, or do I just need to write a freetext comment like this?

-- This is for DuckDB
13 Upvotes

16 comments sorted by

View all comments

Show parent comment

1

u/asp174 Aug 12 '26

Not really. With tail you just throw the rest of the file at it. With a heredoc you have to end the block with a delimiter.

That's why this approach is also used for those nasty install.sh with embedded .tgz files.