Hi!
I need to pull out some metada from database. From every table I want to pull out relations so PK and FK. But I want to have it in form that I will exactly now that FooId is PK in Foo table nad FooBarId is foreign key from FooBar table and so on. And I need it for specified tables.
It can be done by one or more queries for every table so it doesn't have to be one big select. I just need to know how to get this data ;)
TIA
Jarod
you can use SSMS to generate script for all your objects in your database.
Steps:
(1) go to object explorer
(2) select the databse
(3) right click and choose tasks and then choose the subtask 'Generate Scripts....
(4) This wizard will walk you thru the script generation