Controversial: SQL
-
My company uses SourceGear Vault Standard to store tables, stored procs, functions and queries, but I keep a folder of SQL named with a date and purpose. An example would be '20201201_RestoreDataForCustomer'. The date gives me a context to find them more quickly.
Rusty Bullet wrote:
An example would be '20201201_RestoreDataForCustomer'. The date gives me a context to find them more quickly.
:thumbsup: 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
-
There is no good way to store good SQL queries for future use. Just, no good way. :rolleyes:
-
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.
-
I use grepWin on windows to search the content of files. Has regex capabilities too. I use it all the time to find old SQL queries in our installer's collection of SQL files. The secret is to put all the text files in the same (root) folder. Bond Keep all things as simple as possible, but no simpler. -said someone, somewhere
Yeah this is the way most SQL solutions that people have mentioned are done. Text files in a directory, maybe use a file naming convention and then a search tool to find stuff in the SQL itself. It all works and you can wrap a process around it. It just seems like there would be a nice tool.
-
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. :-D 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). :laugh:
-
I don't hate Java, actually. I really like Java as a language. Also, this sounds like the kind of thing that I was thinking might be going on out there -- custom solutions that help you design sql queries and manage them(for devs). :thumbsup:
I meant that you would hate the methodology of writing SQL using another language, not the language itself, since it is more work initially. You have to break the SQL code into pieces to insert variables in between, write the program code and document it. Most of the times I mention this methodology people look at me as if I just told them to program everything in assembly! I use Java for this since it is very easy to convert to a servlet and have the interface on a web page, although I prefer to use the command line. My knowledge of web technologies is limited and all my pages end up looking like :doh:
-
There is no good way to store good SQL queries for future use. Just, no good way. :rolleyes:
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. ;)
Latest Articles:
Thread Safe Quantized Temporal Frame Ring Buffer -
There is no good way to store good SQL queries for future use. Just, no good way. :rolleyes:
evernote or onenote since they allow for naming sub tabs, I can categorize them, make it a little faster to search
-
There is no good way to store good SQL queries for future use. Just, no good way. :rolleyes:
I use a private GitHub repo, and use Agent Ransack on my local laptop to find specific files by key words or phrases.
-
There is no good way to store good SQL queries for future use. Just, no good way. :rolleyes:
-
There is no good way to store good SQL queries for future use. Just, no good way. :rolleyes:
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
-
There is no good way to store good SQL queries for future use. Just, no good way. :rolleyes:
Why use text files? A database can store strings. So if you want searchable storage of queries why not make a table?
-
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. ;)
Latest Articles:
Thread Safe Quantized Temporal Frame Ring BufferMarc 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. :laugh: 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). :laugh:
-
There is no good way to store good SQL queries for future use. Just, no good way. :rolleyes:
So, it depends on which interface you're using. If you're using Management Studio you can save frequently-used queries in 2 places (I've used both over the years): 1) Create a 'Project' (File / New / Project / SQL Server Scripts) and save .SQL files into that project. Kinda clunky for organization, but workable. I used this method as a default, and used file naming for file sorting and commented keywords for searches. Sometimes you have to open the project file and manually rearrange the file references. 2) use the Code Snippets Manager (Tools / Code Snippet Manager) You can create your own Groups and add scripts to existing or new Groups. pretty handy, a little clunky, but it works. I used this area for some very-frequently-used utility scripts. If this info is coming to you late, well - I read your thread early this morning, but didn't get to my computer till now. Take it for what its worth. Cheers,
Time is the differentiation of eternity devised by man to measure the passage of human events. - Manly P. Hall Mark Just another cog in the wheel
-
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.
-
So, it depends on which interface you're using. If you're using Management Studio you can save frequently-used queries in 2 places (I've used both over the years): 1) Create a 'Project' (File / New / Project / SQL Server Scripts) and save .SQL files into that project. Kinda clunky for organization, but workable. I used this method as a default, and used file naming for file sorting and commented keywords for searches. Sometimes you have to open the project file and manually rearrange the file references. 2) use the Code Snippets Manager (Tools / Code Snippet Manager) You can create your own Groups and add scripts to existing or new Groups. pretty handy, a little clunky, but it works. I used this area for some very-frequently-used utility scripts. If this info is coming to you late, well - I read your thread early this morning, but didn't get to my computer till now. Take it for what its worth. Cheers,
Time is the differentiation of eternity devised by man to measure the passage of human events. - Manly P. Hall Mark Just another cog in the wheel
Oh, by the way: if you use Option 1 (SQL files and SQL Project) you can use version control so as to not lose files or their contents.
Time is the differentiation of eternity devised by man to measure the passage of human events. - Manly P. Hall Mark Just another cog in the wheel
-
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.
-
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