|
Posted by Stu on 06/21/06 19:01
No trying to rub salt in your wounds, but this wouldn't be an issue if
you followed a couple of standard programming practices:
1. Avoid SELECT * in production code. Always specify column names
(and aliases if you'd like); it'll make maintenance much easier, and
keep you from having to recompile dependent views if you add or remove
a column at a later date.
2. Use stored procedures as a data access method rather than SQL in
the application; much easier to adjust a stored procedure in one place
rather than several SQL statements throughout your application (not to
mention the security benefits).
There are exceptions to every rule, of course, and I'm not in your
shoes, but it sounds like you need to tighten up your code a bit.
Stu
Mike S wrote:
> Jack Vamvas wrote:
> > You could :
> > SELECT E1.id as "Employees_ID", E2.id as "Employers_ID"
> > FROM Employees as E1 LEFT JOIN Employers AS E2 ON (E1.Id=E2.Id)
>
> I was actually thinking about doing it that way, just aliasing all the
> columns. I was hoping to avoid that because it would involve changing a
> number of existing queries/program code - plus most of the queries are
> 'SELECT * FROM Table" type queries, so to produce the same results, I'd
> have to alias every single column in each table. For this particular
> project, I think it might be easier to deal with names like Id, Id1,
> Id2, etc., even though it's not very readable...oh well, just a matter
> of adding extra comments to the source code ;-)
>
> --
> Mike S
Navigation:
[Reply to this message]
|