Wednesday, January 20, 2016

How can I list all foreign keys referencing a given table in SQL Server?

Here is how you can get list of all foreign key references using below query for all tables in your database

SELECT AS FK_NAME, AS [schema_name], AS [table], AS [column], AS [referenced_table], AS [referenced_column]
FROM sys.foreign_key_columns fkc
INNER JOIN sys.objects obj
ON obj.object_id = fkc.constraint_object_id
INNER JOIN sys.tables tab1
ON tab1.object_id = fkc.parent_object_id
INNER JOIN sys.schemas sch
ON tab1.schema_id = sch.schema_id
INNER JOIN sys.columns col1
ON col1.column_id = parent_column_id

AND col1.object_id = tab1.object_id
INNER JOIN sys.tables tab2
ON tab2.object_id = fkc.referenced_object_id
INNER JOIN sys.columns col2
ON col2.column_id = referenced_column_id

AND col2.object_id = tab2.object_id

Hope this helps!!!

Tuesday, January 12, 2016

Android Version History

The version history of the Android mobile operating system began with the release of the Android alpha in November 2007. The first commercial version, Android 1.0, was released in September 2008. Android is continually developed by Google and the Open Handset Alliance (OHA)


** Added for my own references