|
Rusty Bullet wrote: An example would be '20201201_RestoreDataForCustomer'. The date gives me a context to find them more quickly.
That's one of the tricks I've employed too. but, it also seems to point to a problem that is begging for a management solution. Thanks
|
|
|
|
|
I am always late to the party. HAHAHA. But then I get to read everyone elses comments before I make my own.
What I use is a blend of notepad++ or SSMS and multiple fairly large what I call scratch files. For differing companies and projects I create a scratch SQL project which is mostly commented out sql that includes databases, SPs, Views etc... and then one or 15 differing select statements/kewl sql statements that work for this database scheme.
Then I use Agent Ransack when I am searching for something esoteric that I need for a new client/project.
It works for me and I usually end up cobbling something together from inside the scratch file then copying and pasting into a new SQL for the new SP or View and away I go.
What works for you I guess. PS I do love Agent Ransack.
To err is human to really mess up you need a computer
|
|
|
|
|
rnbergren wrote: It works for me and I usually end up cobbling something together from inside the scratch file then copying and pasting into a new SQL for the new SP or View and away I go.
Yep, that's what it's like. That's why this is interesting to me because it seems like there would be one good solution, but it takes a lot of work to bring together a good way to manage it all. Thanks for your input.
rnbergren wrote: PS I do love Agent Ransack.
another poster mentioned this and i'll be checking it out.
|
|
|
|
|
Save them as .sql files and give them good file names. Then organize them into folders. In other words, treat them like any other application source code.
|
|
|
|
|
That's really the main way to do it. I just don't like sql too much, often forget it and find that since I only have to design queries every few years I am very bored by it.
So, if I could find a way to manage them so I could just find the one I want very easily I would be happy (and it would promote my laziness).
|
|
|
|
|
Why not store them in a database?
You could use SQL to find the best match...
|
|
|
|
|
Other Dev: What'cha doing?
Me: Writing a SQL query to find a SQL query that I can use in this project.
|
|
|
|
|
What, can't you just ask the computer "give me this data" and it writes the SQL query for you?
"Hello, computer."
"Use the keyboard? How archaic!"
I hope y'all know what movie I'm quoting.
|
|
|
|
|
Marc Clifton wrote: can't you just ask the computer "give me this data" and it writes the SQL query for you?
I know. It's quite annoying that I can't. Even Google Home (assistant) won't just tell me answers a lot of the time.
Marc Clifton wrote: I hope y'all know what movie I'm quoting.
I tried DuckDuckGo and got nothing for those quotes.
Maybe, War Games with Matthew Broderick?
Or maybe Star Trek..."Computer...what is our heading?"
|
|
|
|
|
evernote or onenote since they allow for naming sub tabs, I can categorize them, make it a little faster to search
|
|
|
|
|
Matt McGuire wrote: evernote or onenote since they allow for naming sub tabs, I can categorize them, make it a little faster to search
That's an interesting one. I think whatever organization system a dev finds that works for him/her is good. And most people in this thread have said this is basically what they do or just put them all in a text file.
These methods just feel like only one step above keeping them in a plastic binder.
I wish there was a way to really categorize, organize, digitize and systematize the whole situation. But, I'm lazy and slow and I forget SQL all the time (because it is so forgetable).
|
|
|
|
|
Since I'm not the DBA here, I tend to forget how to do simple things like create a table with a index, or how to use cross apply with a function on a table. I only touch these things once in awhile, I needed a way to organize my notes to remember how they work.
It seems once I'm writing SQL it all comes back pretty quick, but when I've been working in code for a few months, all that SQL gets archived in the deep back of my brain, next to the cobwebs and cassette tapes
|
|
|
|
|
Great post!
Your post is exactly what I go through constantly. I may not really need to design and write a new query for 1 or more years. Then I go back and have to invent the wheel all over again.
|
|
|
|
|
I use a private GitHub repo, and use Agent Ransack on my local laptop to find specific files by key words or phrases.
|
|
|
|
|
MSBassSinger wrote: I use a private GitHub repo, and use Agent Ransack on my local laptop to find specific files by key words or phrases.
That's a good combination. Easy to get to from anywhere on the Internet and also you can search them. I'm going to have to look into this agent ransack thing, but the word "ransack" has really put me off it. Many here have mentioned agent ransack.
|
|
|
|
|
Create views with meaningful names?
Isn't that what views are for?
|
|
|
|
|
That's a good thing. I'm more talking about a way to get to old SQL queries / Stored Procs (SP) I've written in past to solve problems which I can use again to solve new problems --- after slightly altering them.
I'm talking about query design and SP creation and managing these old queries I have worked through to get to the answer. I often create some cool query and then 3 years from now I totally forget how i did it.
|
|
|
|
|
Oh, for that I create sql files and store them on servers with multiple backup avenues.
Then I forget where they are and run to the internet to look up ways to solve the problems I can't remember the solutions to.
|
|
|
|
|
Member 8234139 wrote: Oh, for that I create sql files and store them on servers with multiple backup avenues.
Then I forget where they are and run to the internet to look up ways to solve the problems I can't remember the solutions to.
That's exactly my method.
|
|
|
|
|
I wrote a little program called Code Vault it lets me name the snippet of code with a date saved and the code It is searchable from experience it needs a one character field where you enter C for create or U for Update need to rewrite it as it is in VB 6 Just a suggestion
|
|
|
|
|
Yeah a SQL-Vault is the type of thing I'm talking about. It would be nice.
|
|
|
|
|
Sorry for the late reply been working at the hospital a lot
You can find my GitHub here look for PW Keeper
https:
Enter this link in the ADDRESS FIELD not the SEARCH FIELD
|
|
|
|
|
Why use text files? A database can store strings. So if you want searchable storage of queries why not make a table?
|
|
|
|
|
Yes, I'll query the database for the query that I need so I can query the database.
You are correct though. I'm thinking more of a SQL-Manager that allows me to file away SQL queries with a good summary of what it does and keywords for finding.
|
|
|
|
|
So you mean a separate database of queries that hold the queries that you can query so you can query the other database? Maybe OneNote is what you want.
|
|
|
|