Hi All,
I have been able to retrieve the tables within a database automatically via
an sql query. Is there a way that I can retrieve the indexes (with the field
names they are indexing) and relationships (Fields plus tables they are
referencing).
What I am trying to achieve is this.
In VB.Net you have datasets. I would like to populate this dataset based on
the tables of the intended database progromatically and setup the
relationships and indexes rather than having to hardcode it in a class
everytime.
I also need to do this to ensure that when an update is sent out and there
have been database design changes that I can compare the structures,indexes
and relationships to what is needed and alter accordingly
Thanks in advance
Mark Hollander
Look at the code of sp_helpindex, sp_fkeys and other related system stored
procedures. You could do this using sp_helptext, as in:
USE master
GO
EXEC sp_helptext sp_helpindex
GO
This will give you an idea of where the required information is stored in
the system tables.
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Mark Hollander" <mark.hollander@.softris.co.za> wrote in message
news:OLDH96d3FHA.128@.tk2msftngp13.phx.gbl...
Hi All,
I have been able to retrieve the tables within a database automatically via
an sql query. Is there a way that I can retrieve the indexes (with the field
names they are indexing) and relationships (Fields plus tables they are
referencing).
What I am trying to achieve is this.
In VB.Net you have datasets. I would like to populate this dataset based on
the tables of the intended database progromatically and setup the
relationships and indexes rather than having to hardcode it in a class
everytime.
I also need to do this to ensure that when an update is sent out and there
have been database design changes that I can compare the structures,indexes
and relationships to what is needed and alter accordingly
Thanks in advance
Mark Hollander
Showing posts with label automatically. Show all posts
Showing posts with label automatically. Show all posts
Tuesday, March 20, 2012
Subscribe to:
Posts (Atom)