Using smo????
-
Hi, How can I reach database relation diagram of sql by using smo? I want to learn parent key table of any column if that column is foreign key. Forexample, in northwind database, in products table, there is categoryid column. This column is related to id in Category table. I want to find this. Best Regards THANKS
-
Hi, How can I reach database relation diagram of sql by using smo? I want to learn parent key table of any column if that column is foreign key. Forexample, in northwind database, in products table, there is categoryid column. This column is related to id in Category table. I want to find this. Best Regards THANKS
omegazafer wrote:
How can I reach database relation diagram of sql by using smo?
Not possible.
omegazafer wrote:
I want to learn parent key table of any column if that column is foreign key.
Very possible :) You do not need SMO for this. Look at calling one or both of the following stored procedures: sp_foreignkeys sp_primarykeys
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008) -
Hi, How can I reach database relation diagram of sql by using smo? I want to learn parent key table of any column if that column is foreign key. Forexample, in northwind database, in products table, there is categoryid column. This column is related to id in Category table. I want to find this. Best Regards THANKS
omegazafer wrote:
How can I reach database relation diagram of sql by using smo
You can't, and you don't need to. Have a look at my article aboutr smo, it should put you on the right track to get the details you want - although there are also non-smo methods. http://www.codeproject.com/KB/cs/smo.aspx[^]
Bob Ashfield Consultants Ltd
-
omegazafer wrote:
How can I reach database relation diagram of sql by using smo?
Not possible.
omegazafer wrote:
I want to learn parent key table of any column if that column is foreign key.
Very possible :) You do not need SMO for this. Look at calling one or both of the following stored procedures: sp_foreignkeys sp_primarykeys
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008)Thanks, But I don't need only foreign key or primary key columns. The table that the column ,which is foreign key , is related. For example, I search the categoryId column for this in Product table. The result wanted is Category table.(I mention on NorthWind Database) Best Regards
-
omegazafer wrote:
How can I reach database relation diagram of sql by using smo
You can't, and you don't need to. Have a look at my article aboutr smo, it should put you on the right track to get the details you want - although there are also non-smo methods. http://www.codeproject.com/KB/cs/smo.aspx[^]
Bob Ashfield Consultants Ltd
Thanks for you reply, I looked at your article but I didn't understand. Can you explain a little more? Have a good day
-
Thanks, But I don't need only foreign key or primary key columns. The table that the column ,which is foreign key , is related. For example, I search the categoryId column for this in Product table. The result wanted is Category table.(I mention on NorthWind Database) Best Regards
-
Thanks for you reply, I looked at your article but I didn't understand. Can you explain a little more? Have a good day
-
Did you read the docs on those 2 store procedures? :sigh:
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008)Sp_foreign keys gives only foreign key column . I don't need only these as I said before. If it is possible , can you reply my sample question ? Have a good day Kemal Akkanat
-
Sp_foreign keys gives only foreign key column . I don't need only these as I said before. If it is possible , can you reply my sample question ? Have a good day Kemal Akkanat
Look at the source of this article[^]. I wrote it many many years back, and AFAIK I used those procs. You can get all the info you need.
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008) -
Well, its only meant to be an introduction, giving you an idea of what smo can do. Try Googling EnumForeignKeys, it will give you waht you are looking for I think
Bob Ashfield Consultants Ltd
Thanks.