• dmeissner - Tuesday, August 15, 2017 10:54 PM

    Lyle, 

    I'm sorry you don't understand that this is a hypothetical example. There is no schema except that which the viewer chooses. Variables such as my_database,  my_table,  and my_column are clearly placeholders where one can simply swap out to match their schema. Nothing more. 

    I didn't feel it was necessary to include code for creating tables and inserting records, as that was not the object of discussion.  I think most people would recognize it for what it is. If not, they merely need to ask.

    If you would like to add some sql for that, be my guest. What would really be helpful is if people tried out the solution and commented on how it worked or didn't work for them for the sake of others looking for a solution. That would be extremely productive. 

    Again, I would like to say that my initial post after this thread was dormant for so long was plain and simple sarcasm. It was not directed at anybody. If fact, I never imagined that anyone would still be subscribed to the thread. I thought it would most likely be seen only by people searching for the same topic as I was.

    Whoa.  In your code no schema can be selected because you totally ignore the schema, period.  You have placeholders for the database, table, and column, nothing else.  Using a three part name convention (database.schema.table) you ignore things like MyDatabase.dbo.MyTable and MyDatabase.MySchema.MyTable for tables.

    So, how would you modify your code to account for different schema in a database?  I already know how I would do it, I want to see if you know or can figure it out.