Title: Message

As I said, horses for courses.

 

-----Original Message-----
From: Andreas Toth [mailto:[EMAIL PROTECTED]]
Sent:
Wednesday, 2 October 2002 12:25 p.m.
To: Multiple recipients of list delphi
Subject: RE: RE: Re: [DUG]: Column Names

 

That's to be discovered... :) Just kidding.

 

There's really too much to go into here, but one of the things that I've experienced is renaming **heaps** of tables using this technique. Suddenly you have to rename the columns as well or the whole scheme falls over which then breaks all your SQL code even more than renaming the tables did. (For your information, in the end we ended up dropping the prefix convention). A real pain in the backside. Next there's all the stuff Neven pointed out about joins and readability not to mention applications that try to auto-join no longer can since they don't understand what's going on. There's more but I can't recall it at this stage...

 

My recommendation is to use the table.column (or alias.column) naming-convention to improve readability in SQL code, and not try to do this at the column level. It's hierarchical after all -- the columns don't know about the table, but the table knows about its columns, but the tables don't know about each other (assuming relationships are not used), etc. So why try to twist the paradigm?

 

 

-Andreas

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Peter Speden
Sent:
Wednesday, 2 October 2002 11:36
To: Multiple recipients of list delphi
Subject: RE: RE: Re: [DUG]: Column Names

I’m intrigued, what unforeseen problems have you come across.

 

-----Original Message-----
From: Andreas Toth [mailto:[EMAIL PROTECTED]]
Sent:
Wednesday, 2 October 2002 11:25 a.m.
To: Multiple recipients of list delphi
Subject: RE: Re: [DUG]: Column Names

 

Prefixing a table name in front of a table can lead to a lot of unforseen problems down the track especially if the fields are really the same, such as the ID in the example below. My recommendation is not to use this technique.

 

 

-Andreas

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Peter Speden
Sent:
Wednesday, 2 October 2002 11:12
To: Multiple recipients of list delphi
Subject: RE: Re: [DUG]: Column Names

Neven

 

Going back to the original SQL you wrote, given that you are doing an inner join on StoreID in the two tables then selecting the two is irrelevant as they will be the same. 

 

So this appears to be just a hypothetical. 

 

Also most of the people I know who design SQL DBs usually prefix a tablename code in front of the field in the db ie in your case we would have s_STOREID and sc_STOREID.  This makes it unique in views as well.  SQL server when designing views where fieldnames are the same will make one of them have an alias (defaults to Expr1), so thinking that it isn’t really a limitation of TDataset in this case. 

 

I can see your point though, but think it is at a hypothetical level.  Perhaps you should write your own TField that supports this functionality.

 

 

Reply via email to