Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
nmonte
Starting Member
2 Posts |
Posted - 2001-07-27 : 09:10:30
|
| I'm wondering if anyone knows of a code snippet, or tool out there that would do the following.. It's basically a query builder..-- accept 1 or more tables as input-- examine the table(s) for possible joins(by finding matching field names in each table)-- return 1 or more sql strings for each possible join typeFor example here are 3 tables example..TASKS========taskidprojectidstatusidtaskPROJECTS==========projectidprojectSTATUS=========statusidstatusI'd want to have it return the following sql strings...select * from tasks,projects,status where projects.projectid = tasks.projectid and status.statusid = tasks.statusidselect * from tasks left join status on status.statusid = tasks.statusid, projects where projects.projectid = tasks.projectidselect * from tasks right join status on status.statusid = tasks.statusid, projects where projects.projectid = tasks.projectidselect * from tasks left join projects on projects.projectid = tasks.projectid, status where status.statusid = tasks.statusidselect * from tasks right join projects on projects.projectid = tasks.projectid, status where status.statusid = tasks.statusidselect * from tasks left join projects on projects.projectid = tasks.projectid left join status on status.statusid = tasks.statusidselect * from tasks right join projects on projects.projectid = tasks.projectid right join status on status.statusid = tasks.statusidetc...I could probably write it, but I thought it might already exist somewhere.Thanks.Nathan |
|
|
|
|
|