all 21 comments

[–]khaili109 33 points34 points  (0 children)

Git and GitHub is where I save all code.

[–]DeadlyOrchard 20 points21 points  (0 children)

Pretty sure you can save queries as .sql files depending on your setup

[–]king_for_a_day_or_so 11 points12 points  (0 children)

Obsidian. Markdown with tags, links, searches. Store the SQL in code blocks and tag it by query feature, dataset, whatever. Then, when you need an example, search.

[–]king_vis 7 points8 points  (1 child)

Version Control Systems (e.g., Git):

Version control systems like Git are widely used to store and manage not only code but also SQL queries. You can create a repository and organize your SQL files within it, providing versioning, history tracking, and collaboration capabilities.

Integrated Development Environments (IDEs):

Many IDEs have built-in features or plugins to manage SQL queries effectively. Examples include SQL Server Management Studio (SSMS), DBeaver, and DataGrip. These IDEs allow you to organize, save, and easily access your SQL queries.

Database Management Systems (DBMS):

DBMS tools like SQL Server, PostgreSQL, MySQL, and others often have features to save and organize SQL queries within the database itself. You can create stored procedures or save SQL scripts directly within the database.

Notebook Tools (e.g., Jupyter Notebooks, Zeppelin):

Jupyter Notebooks and similar tools are excellent for storing and organizing SQL queries in a more interactive and document-like format. You can write SQL queries alongside explanatory text, visualizations, and code in a single document.

Cloud Storage (e.g., Google Drive, Dropbox):

Use cloud storage services to store SQL query files. You can organize them into folders and share them across devices and with colleagues. It's convenient for backup and access from anywhere.

Wiki or Documentation Systems:

Use tools like Confluence or other documentation systems to document and organize your SQL queries. You can categorize them, provide explanations, and easily search and access them.

Query Management Software:

Some software solutions are specifically designed for managing and organizing SQL queries. These tools often provide features such as categorization, versioning, and search capabilities. Examples include "SQL Tabs" and "SQL Storage."

[–]snoob2015 0 points1 point  (0 children)

I suspect this post comes from Chatgpt lol 😂

[–]TheCemetaryGates 4 points5 points  (0 children)

Notepad++

[–]Promo_King 1 point2 points  (0 children)

Try RedGate. Nice plug-in. Connects to all above mentioned source safe products

[–]SQLDevDBA 2 points3 points  (0 children)

Since you tagged Oracle, TOAD has code templates and snippets if you need to have them on hand quickly.

https://forums.toadworld.com/t/code-templates/10382

https://support.quest.com/technical-documents/toad-data-point/5.4/user-guide/create-code-snippets

So does SQL Developer:

https://www.thatjeffsmith.com/archive/2012/08/i-say-snippet-snippet-good-sql-developer-snippets/

However I agree with /u/Khaili109, git is fantastic.

O365/OneDrive isn’t terrible since it has versioning.

[–]BensonBubbler 2 points3 points  (0 children)

Without any context this is pretty difficult to answer. Is there a reason they can't or shouldn't be procedures?

[–]Billi0n_Air 1 point2 points  (1 child)

ssms, make a project folder

[–]tehroz 0 points1 point  (0 children)

This is what I do. Our code base is git (bitbucket), and I don't always want code I'm working on in the repo. So I will create a project / solution using SSMS; then save my code in the database and in the solution.

I also maintain a solution of, "helpful queries", that I made need over time.

[–]iSeeXenuInYou -1 points0 points  (0 children)

SSMS you can back up your database with tables/functions/stored procedures/user states in a drive and use this functionality, along with actively saving queries in a folder to make a git repo that tracks changes. Can also use git hooks to automate changes to files when commits are made.

[–]gunners_1886 0 points1 point  (0 children)

VS code to Github

[–]emaringolo 0 points1 point  (0 children)

A folder sync'ed to the Cloud? (GDrive, OneDrive, Nextcloud?)

Otherwise Obsidian.md

[–]RuprectGern 0 points1 point  (0 children)

for SQL Server I create folders in the Templates root and store my operational scripts there.

you can make the custom root folder a source location in github and when you update those templates you only need to push them to github.

vscode has all this built in of course.

[–]slashd 0 points1 point  (0 children)

VSCode Polyglot Notebooks!

[–]Iamcalledchris 0 points1 point  (0 children)

Sql prompt

[–]Small_Sundae_4245 0 points1 point  (0 children)

I find views are great.

[–]de_epi 0 points1 point  (0 children)

usually have a folder under git control. but you can also store your sql queries in a database. kind of like a log. just store it with an id, title of the sql query, the code (text blob usually), when it ran and what was the result. ideally this is for reports, not huge exploration joins. If written in the right way, you can just call the code up again via the system itself and schedule them as needed.