Getting the source table from a recordset field? 
Author Message
 Getting the source table from a recordset field?
I have an ADO recordset and would like to determine the source of a column
(the table name). I'm using SQL 7.0. Is there a way I can do this?

Thanks,
Ray



Tue, 16 Dec 2003 01:43:26 GMT
 Getting the source table from a recordset field?

Hello Ray:

You can do a couple of things that I'm familiar with:

1.  Create a recordset that returns the table names using
the following SQL query I wrote against the Northwind
database in SQL Server 2k.  It should work fine in 7.0
also.

Query:
           select syscolumns.name, sysobjects.name
           from syscolumns, sysobjects
           where syscolumns.name = 'customerid'
           and syscolumns.id = sysobjects.id

The above query returns the column name and each table
associated with each column with the same name.  In other
words, the column "customerid" exists in more than one
table in the Northwind database.

or you can use the SQL-DMO object library which is what
MSFT recommends as opposed to hitting the system tables
directly because they can change and therefore break your
query.  It's a bit slower, but at least you have a nice
object model to use.

Quote:
>-----Original Message-----
>I have an ADO recordset and would like to determine the
source of a column
>(the table name). I'm using SQL 7.0. Is there a way I can
do this?

>Thanks,
>Ray

>.



Tue, 16 Dec 2003 03:16:14 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. get the source table.field name from a view's field

2. how could I get the source table name and field name from a view field

3. Recordset: problem setting/getting a GUID field

4. getting distinct recordset back in a record which includes a text field

5. getting list of fields from recordset

6. ADO recordset's memo field gets truncated at 254 characters

7. ODBC recordset not getting all fields???

8. Recordset--join tables in different data sources?

9. recordset should show two fields from two tables, tables have nothing in common

10. Getting tables from recordset?

11. HELP: Getting the WHERE from 1) the filter window or 2) a table recordset

12. client (vb/ado) recordset off a stor proc which gets its recordset from another stor proc


 
Powered by phpBB® Forum Software