Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Controversial: SQL

Controversial: SQL

Scheduled Pinned Locked Moved The Lounge
database
76 Posts 34 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Mark Starr

    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

    M Offline
    M Offline
    Mark Starr
    wrote on last edited by
    #64

    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

    1 Reply Last reply
    0
    • C cwjinc

      Create views with meaningful names? Isn't that what views are for?

      R Offline
      R Offline
      raddevus
      wrote on last edited by
      #65

      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.

      C 1 Reply Last reply
      0
      • C Choroid

        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

        R Offline
        R Offline
        raddevus
        wrote on last edited by
        #66

        Yeah a SQL-Vault is the type of thing I'm talking about. It would be nice.

        C 1 Reply Last reply
        0
        • U User 10911256

          Why use text files? A database can store strings. So if you want searchable storage of queries why not make a table?

          R Offline
          R Offline
          raddevus
          wrote on last edited by
          #67

          Yes, I'll query the database for the query that I need so I can query the database. :laugh: 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.

          U 1 Reply Last reply
          0
          • M Mark Starr

            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

            R Offline
            R Offline
            raddevus
            wrote on last edited by
            #68

            This is good stuff. I will read over this again and try it out. Thanks very much for reading and posting. :thumbsup:

            M 1 Reply Last reply
            0
            • R raddevus

              This is good stuff. I will read over this again and try it out. Thanks very much for reading and posting. :thumbsup:

              M Offline
              M Offline
              Mark Starr
              wrote on last edited by
              #69

              Sure. No prob. If you have any questions, please send them.

              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

              1 Reply Last reply
              0
              • R raddevus

                Yes, I'll query the database for the query that I need so I can query the database. :laugh: 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.

                U Offline
                U Offline
                User 10911256
                wrote on last edited by
                #70

                So you mean a separate database of queries that hold the queries that you can query so you can query the other database? :-D Maybe OneNote is what you want.

                1 Reply Last reply
                0
                • R raddevus

                  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.

                  C Offline
                  C Offline
                  cwjinc
                  wrote on last edited by
                  #71

                  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. ;)

                  R 1 Reply Last reply
                  0
                  • C cwjinc

                    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. ;)

                    R Offline
                    R Offline
                    raddevus
                    wrote on last edited by
                    #72

                    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. :laugh:

                    1 Reply Last reply
                    0
                    • R raddevus

                      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:

                      M Offline
                      M Offline
                      Matt McGuire
                      wrote on last edited by
                      #73

                      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 :laugh:

                      R 1 Reply Last reply
                      0
                      • M Matt McGuire

                        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 :laugh:

                        R Offline
                        R Offline
                        raddevus
                        wrote on last edited by
                        #74

                        Great post! :thumbsup::thumbsup::thumbsup: 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.

                        1 Reply Last reply
                        0
                        • R raddevus

                          OriginalGriff wrote:

                          I have sections in my text file ... because I'm lazy ...

                          :thumbsup: That made me laugh too. I would like: 1) way to pick tables and fields (returned in query) 2) have notes that remind me what the query does 3) have a good way to find them again -- this wouldn't be easy to do I end up saving large SQL text files all over the place and then later searching through them and it takes just about as long to find them as it does to just think it all out again. I'm just wishing over here. :-D It would be very difficult to really create a good organizer. I guess I'm even lazier than I thought. (which I didn't think was possible)

                          U Offline
                          U Offline
                          User 10646402
                          wrote on last edited by
                          #75

                          Could you store them in a table? You will need to do data entry no matter which solution you choose, so keeping them in a utilities database or table would work as well as anything else.

                          1 Reply Last reply
                          0
                          • R raddevus

                            Yeah a SQL-Vault is the type of thing I'm talking about. It would be nice.

                            C Offline
                            C Offline
                            Choroid
                            wrote on last edited by
                            #76

                            Sorry for the late reply been working at the hospital a lot You can find my GitHub here look for PW Keeper

                            https://github.com/e-d-n/A-Free-Offer

                            Enter this link in the ADDRESS FIELD not the SEARCH FIELD

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups