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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 i want to check Field Relation Ship

Author  Topic 

meekredd
Starting Member

2 Posts

Posted - 2011-05-17 : 06:50:44
Hi Experts,

i create a one database.it contains 150 tables.in one tables i have created one Field Like AGE.But That field have lot of relation ships like Foreignkey and etc with other tables.how can i find wat are the tables are have relationship with this fields.

Becoz i am not able to change the datatype of this Field.Please tell me anyone know about this?

Advance Thanks,

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2011-05-17 : 06:56:08
Perhaps this will help all around:
http://www.functionx.com/sql/

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

Ranjit.ileni
Posting Yak Master

183 Posts

Posted - 2011-05-17 : 06:56:37
Hi,
Check this .,

-- Find Tables With Foreign Key Constraint in Database

SELECT
f.name AS ForeignKey
,OBJECT_NAME(f.parent_object_id) AS TableName
,COL_NAME(fc.parent_object_id,fc.parent_column_id) AS ColumnName
,OBJECT_NAME (f.referenced_object_id) AS ReferenceTableName
,COL_NAME(fc.referenced_object_id,fc.referenced_column_id) AS ReferenceColumnName
FROM sys.foreign_keys AS f
INNER JOIN sys.foreign_key_columns AS fc ON f.OBJECT_ID = fc.constraint_object_id
order by OBJECT_NAME(f.parent_object_id)



and put where condition as per your requirement

--Ranjit
Go to Top of Page

kashyap_sql
Posting Yak Master

174 Posts

Posted - 2011-05-17 : 09:23:30
quote:
Originally posted by DonAtWork

Perhaps this will help all around:
http://www.functionx.com/sql/

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp



nice links :)

With Regards
Kashyap M
Go to Top of Page

meekredd
Starting Member

2 Posts

Posted - 2011-05-18 : 05:41:15
Thankyou for all.but it shows some error
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2011-05-18 : 06:03:34
Get Tables List With Dependent Tables Name
http://connectsql.blogspot.com/2010/11/get-tables-list-with-dependent-tables_11.html

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-05-18 : 09:46:06
let me get this straight...a column called age has a lot of relationship to a lot of other tables?

Is that correct sir?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -