October 23, 2023 at 12:00 am
Comments posted to this topic are about the item The Column Synonym
October 23, 2023 at 1:54 pm
You CAN, however, create a simple "Pass through view" that will do the trick.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 23, 2023 at 7:07 pm
You can also add a computed column to the table - but I really don't see the need or requirement to create a column with multiple names. It is just as easy to alias a column in a query as it would be to use a view or computed column - which would just end up being even more confusing.
Imagine a view is created - that references a computed column which only exists to give the column a different name - and aliases the computed column to the original column name. And then, someone includes that aliased column in the WHERE clause...
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
October 26, 2023 at 12:38 am
You can also add a computed column to the table - but I really don't see the need or requirement to create a column with multiple names. It is just as easy to alias a column in a query as it would be to use a view or computed column - which would just end up being even more confusing.
Imagine a view is created - that references a computed column which only exists to give the column a different name - and aliases the computed column to the original column name. And then, someone includes that aliased column in the WHERE clause...
If you mean "use more than a 2 part naming convention", except for the system database, I avoid more than the 2 part naming convention at all costs because databases don't always stay in the same place. I'd rather just change the target of a synonym or view than to try to find all the places in code (both SQL and Front End) that uses 3 or 4 part naming.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 26, 2023 at 9:23 pm
Jeffrey Williams wrote:Imagine a view is created - that references a computed column which only exists to give the column a different name - and aliases the computed column to the original column name. And then, someone includes that aliased column in the WHERE clause...
If you mean "use more than a 2 part naming convention", except for the system database, I avoid more than the 2 part naming convention at all costs because databases don't always stay in the same place. I'd rather just change the target of a synonym or view than to try to find all the places in code (both SQL and Front End) that uses 3 or 4 part naming.
Not referring to 2 part naming or actual synonyms. Was being a bit tongue in cheek - I don't see any value to a column synonym since you can add an alias to your query and return any column name as you want.
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
October 26, 2023 at 9:40 pm
Jeff Moden wrote:Jeffrey Williams wrote:Imagine a view is created - that references a computed column which only exists to give the column a different name - and aliases the computed column to the original column name. And then, someone includes that aliased column in the WHERE clause...
If you mean "use more than a 2 part naming convention", except for the system database, I avoid more than the 2 part naming convention at all costs because databases don't always stay in the same place. I'd rather just change the target of a synonym or view than to try to find all the places in code (both SQL and Front End) that uses 3 or 4 part naming.
Not referring to 2 part naming or actual synonyms. Was being a bit tongue in cheek - I don't see any value to a column synonym since you can add an alias to your query and return any column name as you want.
Ah... got it. I use "Pass thru Views" in such a fashion for limit columns in the same or other databases for security and performance purposes. Sure... go ahead and use "SELECT *" on that! 😀
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply