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. Stupid request of the day

Stupid request of the day

Scheduled Pinned Locked Moved The Lounge
databasecollaborationquestionannouncement
25 Posts 11 Posters 2 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.
  • L Lost User

    I've had similar problem once, here is the solution: SELECT c.name AS 'ColumnName' ,t.name AS 'TableName' FROM sys.columns c JOIN sys.tables t ON c.object_id = t.object_id WHERE c.name LIKE '%MyName%' ORDER BY TableName ,ColumnName; [sql - Find all tables containing column with specified name - Stack Overflow](http://stackoverflow.com/questions/4849652/find-all-tables-containing-column-with-specified-name)

    C Offline
    C Offline
    Chris Quinn
    wrote on last edited by
    #4

    That will show you if there is a column of a particular name - what he was asking was "is there any column in any table on the database that contains "G:" in the data

    ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================

    L 1 Reply Last reply
    0
    • C Chris Quinn

      That will show you if there is a column of a particular name - what he was asking was "is there any column in any table on the database that contains "G:" in the data

      ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #5

      Oh, well, from top of my head, I would just select all the tables, all the columns and would loop through them with a select query :)

      L OriginalGriffO 2 Replies Last reply
      0
      • L Lost User

        Oh, well, from top of my head, I would just select all the tables, all the columns and would loop through them with a select query :)

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #6

        ..loop through three terrabytes worth? :wtf:

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

        P L 2 Replies Last reply
        0
        • L Lost User

          ..loop through three terrabytes worth? :wtf:

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

          P Offline
          P Offline
          Pualee
          wrote on last edited by
          #7

          Yes, with a cursor that locks each table, to prevent anyone inserting the G: value after you already checked. It is the only exhaustive, thread-safe, conclusive, and accurate way to know! A better method by be to ask "why".

          L 1 Reply Last reply
          0
          • L Lost User

            Oh, well, from top of my head, I would just select all the tables, all the columns and would loop through them with a select query :)

            OriginalGriffO Offline
            OriginalGriffO Offline
            OriginalGriff
            wrote on last edited by
            #8

            No, write the query, and send it to him to execute... :-D

            Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            1 Reply Last reply
            0
            • C Chris Quinn

              From a colleague in our release team: >Do we have any field in the live database that contains "G:"? The database has approximately 600 tables, each having an average of about 25 columns, and the data stretches to about 3TB at the moment. WTF!

              ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================

              N Offline
              N Offline
              Nish Nishant
              wrote on last edited by
              #9

              The easiest way to solve this is to insert a new row into a table and have G: as part of the content for a column's data. Now answer "yes" and if he asks for the data, just send him the row you just inserted. You are welcome. :cool:

              Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com

              C Z A M 4 Replies Last reply
              0
              • P Pualee

                Yes, with a cursor that locks each table, to prevent anyone inserting the G: value after you already checked. It is the only exhaustive, thread-safe, conclusive, and accurate way to know! A better method by be to ask "why".

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #10

                The why is obvious, it's a nonsense request. Must be something clever from a managers' point of view.

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                P Sander RosselS 2 Replies Last reply
                0
                • L Lost User

                  ..loop through three terrabytes worth? :wtf:

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #11

                  Nope, sys.tables gives you the tables, sys.colums gives you the columns and sys.types gives the data types. You have to execute select statements on text type columns. You would have around 1000 select statements to loop through, not the actual data

                  L 1 Reply Last reply
                  0
                  • N Nish Nishant

                    The easiest way to solve this is to insert a new row into a table and have G: as part of the content for a column's data. Now answer "yes" and if he asks for the data, just send him the row you just inserted. You are welcome. :cool:

                    Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com

                    C Offline
                    C Offline
                    Chris Quinn
                    wrote on last edited by
                    #12

                    Genius!

                    ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================

                    1 Reply Last reply
                    0
                    • N Nish Nishant

                      The easiest way to solve this is to insert a new row into a table and have G: as part of the content for a column's data. Now answer "yes" and if he asks for the data, just send him the row you just inserted. You are welcome. :cool:

                      Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com

                      Z Offline
                      Z Offline
                      ZurdoDev
                      wrote on last edited by
                      #13

                      Exactly!! :doh:

                      There are two kinds of people in the world: those who can extrapolate from incomplete data. There are only 10 types of people in the world, those who understand binary and those who don't.

                      1 Reply Last reply
                      0
                      • N Nish Nishant

                        The easiest way to solve this is to insert a new row into a table and have G: as part of the content for a column's data. Now answer "yes" and if he asks for the data, just send him the row you just inserted. You are welcome. :cool:

                        Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com

                        A Offline
                        A Offline
                        Albert Holguin
                        wrote on last edited by
                        #14

                        This guy knows what's up... :thumbsup::cool:

                        1 Reply Last reply
                        0
                        • L Lost User

                          The why is obvious, it's a nonsense request. Must be something clever from a managers' point of view.

                          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                          P Offline
                          P Offline
                          Pualee
                          wrote on last edited by
                          #15

                          What I'm saying is this nonsense request could have an underlying question that wasn't stated, and could possibly be answered in a very simple and easy way... which would be a win for the one asking... and educational in a way that prevents stupid questions from coming up again, which anger and derail the developers.

                          1 Reply Last reply
                          0
                          • L Lost User

                            The why is obvious, it's a nonsense request. Must be something clever from a managers' point of view.

                            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                            Sander RosselS Offline
                            Sander RosselS Offline
                            Sander Rossel
                            wrote on last edited by
                            #16

                            Or worse, a clever programmer!

                            if (data.Contains("G:"))
                            {
                            // No one will ever use this value so we can use it for (some template?)...
                            }

                            :~

                            Best, Sander arrgh.js - Bringing LINQ to JavaScript SQL Server for C# Developers Succinctly Object-Oriented Programming in C# Succinctly

                            1 Reply Last reply
                            0
                            • C Chris Quinn

                              From a colleague in our release team: >Do we have any field in the live database that contains "G:"? The database has approximately 600 tables, each having an average of about 25 columns, and the data stretches to about 3TB at the moment. WTF!

                              ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================

                              P Offline
                              P Offline
                              PIEBALDconsult
                              wrote on last edited by
                              #17

                              Time for the Wally Deflector... Dilbert Comic Strip on 2005-07-10 | Dilbert by Scott Adams[^]

                              L 1 Reply Last reply
                              0
                              • C Chris Quinn

                                From a colleague in our release team: >Do we have any field in the live database that contains "G:"? The database has approximately 600 tables, each having an average of about 25 columns, and the data stretches to about 3TB at the moment. WTF!

                                ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================

                                M Offline
                                M Offline
                                MacSpudster
                                wrote on last edited by
                                #18

                                "So, you wanna know if we've a 'G' string riding up next to someone's colon, then?" :wtf:

                                Ask a stupid question...

                                1 Reply Last reply
                                0
                                • L Lost User

                                  Nope, sys.tables gives you the tables, sys.colums gives you the columns and sys.types gives the data types. You have to execute select statements on text type columns. You would have around 1000 select statements to loop through, not the actual data

                                  L Offline
                                  L Offline
                                  Lost User
                                  wrote on last edited by
                                  #19

                                  You'd be looping all text-columns and memo-fields (up to 2Gb potentially), within all tables. That's two loops, continously crunching on the DB-server. To find a two-character string? The only correct answer can be that there'd better be a friggin' good reason for the request, and to request what the elephant they were doing so you can write a more specific query. I doubt that the two characters could hide 'anywhere'.

                                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                                  L 1 Reply Last reply
                                  0
                                  • L Lost User

                                    You'd be looping all text-columns and memo-fields (up to 2Gb potentially), within all tables. That's two loops, continously crunching on the DB-server. To find a two-character string? The only correct answer can be that there'd better be a friggin' good reason for the request, and to request what the elephant they were doing so you can write a more specific query. I doubt that the two characters could hide 'anywhere'.

                                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                                    L Offline
                                    L Offline
                                    Lost User
                                    wrote on last edited by
                                    #20

                                    Hey, if his live depends on it, I'm suggesting a solution. Actually it's not that bad. you can: select TableName, columnName from whatever joins you need to do on all columns that are text, varchar, nchar etc. Then you run select count(ColumnName) from TableName where columName like '%whatever you search%' Let's say 1-2 secs per query on a table up to 1 million records, he will have the answers in a hour or two. It's a ridiculous request, but you know, if he absolutely needs to do it ...

                                    L 1 Reply Last reply
                                    0
                                    • L Lost User

                                      Hey, if his live depends on it, I'm suggesting a solution. Actually it's not that bad. you can: select TableName, columnName from whatever joins you need to do on all columns that are text, varchar, nchar etc. Then you run select count(ColumnName) from TableName where columName like '%whatever you search%' Let's say 1-2 secs per query on a table up to 1 million records, he will have the answers in a hour or two. It's a ridiculous request, but you know, if he absolutely needs to do it ...

                                      L Offline
                                      L Offline
                                      Lost User
                                      wrote on last edited by
                                      #21

                                      Bad Hombre wrote:

                                      Actually it's not that bad.

                                      Agreed, it is not 'that bad', but it is absolutely not what I want to hear from a specialist. Given the amount of data, and the type of request, and given that you have the freedom to make better suggestions, I'd expect one. Any decent database-operator will have a backup of anything on that server. Go search that and leave the production database alone. Ask where the customer "lost his G:", on which page, which application. Ask for a date-range. When did you have your G:? Ask whether it is actually feasible - in a database full with blobs you're bound to run into that combination, how do you know if it is the G: that the client is looking for, or just a random G:? Could it be in an encrypted or compacted field, and if so, do you want to search those too? Do you seriously need to search usernames and hash-columns, any logging-tables, if the customer cannot have lost his G: there?

                                      Bad Hombre wrote:

                                      It's a ridiculous request, but you know, if he absolutely needs to do it ...

                                      Instead of doing something rediculous because you're simply told to do so, you could try and recognize a failure in communication and offer an intelligent alternative.

                                      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                                      L 1 Reply Last reply
                                      0
                                      • P PIEBALDconsult

                                        Time for the Wally Deflector... Dilbert Comic Strip on 2005-07-10 | Dilbert by Scott Adams[^]

                                        L Offline
                                        L Offline
                                        Lost User
                                        wrote on last edited by
                                        #22

                                        I have to side with Wally. You cannot start normalization without knowing the structure; all the fields need to be known.

                                        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                                        1 Reply Last reply
                                        0
                                        • L Lost User

                                          Bad Hombre wrote:

                                          Actually it's not that bad.

                                          Agreed, it is not 'that bad', but it is absolutely not what I want to hear from a specialist. Given the amount of data, and the type of request, and given that you have the freedom to make better suggestions, I'd expect one. Any decent database-operator will have a backup of anything on that server. Go search that and leave the production database alone. Ask where the customer "lost his G:", on which page, which application. Ask for a date-range. When did you have your G:? Ask whether it is actually feasible - in a database full with blobs you're bound to run into that combination, how do you know if it is the G: that the client is looking for, or just a random G:? Could it be in an encrypted or compacted field, and if so, do you want to search those too? Do you seriously need to search usernames and hash-columns, any logging-tables, if the customer cannot have lost his G: there?

                                          Bad Hombre wrote:

                                          It's a ridiculous request, but you know, if he absolutely needs to do it ...

                                          Instead of doing something rediculous because you're simply told to do so, you could try and recognize a failure in communication and offer an intelligent alternative.

                                          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                                          L Offline
                                          L Offline
                                          Lost User
                                          wrote on last edited by
                                          #23

                                          I said text columns, not varbinary. This pretty much excludes blobs, also you can exclude columns with max_length let's say 2000 characters. Edit: And I'm not a database operator, administrator or anything like that, just a lowly mobile developer, so I don't insist on having the perfect solution. :)

                                          L 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