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 obj.name AS FK_NAME,
sch.name AS [schema_name],
tab1.name AS [table],
col1.name AS [column],
tab2.name AS [referenced_table],
col2.name 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)

2016-05-23_1414

** Added for my own references

Wednesday, December 09, 2015

Microsoft Office update #KB3114409

If your system is currently running Microsoft Office 32 Bit version, you may have an issue with Outlook starting in Safe Mode after the updates have been applied.

Microsoft update KB3114409 should be removed if you are experiencing this behavior.

64 Bit Office applications are not affected by this update.

Tuesday, November 17, 2015

TextBox set to ReadOnly using javascript

Here is a quick solution that works across the all browsers. Add below code in input textbox.

onKeyPress = "javascript: return false;" onPaste = "javascript: return false;" .

That way, even the textbox is enabled, the user will not be able to modify the data

Tuesday, October 20, 2015

C# Character Escape Sequences

Character combinations consisting of a backslash (\) followed by a letter or by a combination of digits are called "escape sequences." To represent a newline character, single quotation mark, or certain other characters in a character constant, you must use escape sequences. An escape sequence is regarded as a single character and is therefore valid as a character constant.

In C# you can use the backslash to put special characters to your string. For example, to put ", you need to write \". There are a lot of characters that you write using the backslash: Backslash with a number:

  • \000 null
  • \010 backspace
  • \011 horizontal tab
  • \012 new line
  • \015 carriage return
  • \032 substitute
  • \042 double quote
  • \047 single quote
  • \134 backslash
  • \140 grave accent

Backslash with other character

  • \' - single quote, needed for character literals
  • \" - double quote, needed for string literals
  • \\ – backslash
  • \0 - Unicode character 0
  • \a - Alert (character 7)
  • \b - Backspace (character 8)
  • \f - Form feed (character 12)
  • \n - New line (character 10)
  • \r - Carriage return (character 13)
  • \t - Horizontal tab (character 9)
  • \v - Vertical quote (character 11)
  • \uxxxx - Unicode escape sequence for character with hex value xxxx
    \xn[n][n][n] - Unicode escape sequence for character with hex value nnnn (variable length version of \uxxxx)
  • \Uxxxxxxxx - Unicode escape sequence for character with hex value xxxxxxxx (for generating surrogates

Hope this helps!!