• About Nibu

bits and bytes

Best ever free blog on: C, C++, VC++, .net, Debugging, Memory Dump analysis, Windbg/CDB, Visual Studio, SharePoint and PowerShell
  • About Nibu

SQL: Column metadata query

 SQL  Add comments
Nov 112020
 

A friend of mine asked a question on how to retrieve SQL column metadata, hence wrote this query with help from stack overflow.

I had to make some adaptations; basically used a nested query to create temporary result set in order to apply a filter on a column alias.

In order to use this query please remember to change value for the Where clause on column alias TableName. For e.g. ‘%MyTableName%’ to filter any TableName containing string ‘MyTableName’. For exact results please remove %% from the where clause. For e.g. ‘MyTableName’.

You can add more columns to this output by choosing columns from output of following query: select * from sys.columns. Then add the column to the nested query along with an appropriate column alias.

Select * from 
(Select 
object_NAME(Columns.object_id) As TableName, 
Columns.name As 'ColumnName', 
Types.name As 'Type', 
Columns.max_length As 'Length/Size'
from sys.columns Columns INNER JOIN sys.types Types  ON Types.system_type_id = Columns.system_type_id) 
AllColumnMetaData
Where TableName like '%sysrscols%'
Output Screenshot
Column metadata query output screenshot.

Hope this helps. Good day!

Related

 Posted by Nibu Thomas at 2:32 pm  Tagged with: column metadata, metadata, Nested query, SQL

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • SQL: Column metadata query
  • PowerShell: Working with System.Security.Claims.ClaimsIdentity to manage user identity
  • ActiveDirectory: PowerShell script to translate a Windows SecurityIdentifier (SIDs) to UserNames using System.Security.Principal.SecurityIdentifier.Translate
  • SharePoint: Find an SPFeature by DisplayName
  • PowerShell TidBits: Creating Excel Workbook and filling out data into WorkSheets

Tags

.net ActiveX ATL CComboBox CDialog Clipboard COM Console API Console Application cout CreateProcess CString Debug Debugger Debugging dumpbin Feature pack GDI Interview questions MVP MVP Summit MVP Summit 2008 Nibu Nibu babu thomas Nibu Thomas PowerShell Ray Ozzie Redmond SetBkMode SetWindowPos Sharepoint ShGetFileInfo Steve Ballmer stl Summit VC8 vector Visual studio Visual Studio 2013 VS2005 VS2008 VS2013 windbg Windows Windows Phone

Follow Me

RSS YouTube Facebook Twitter Google+

Subscribe to this blog

RSS Feed RSS - Posts

RSS Feed RSS - Comments

Donate

View Nibu Thomas's profile on LinkedIn
Subscribe

Visitors

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 99 other subscribers

Articles

  • About Nibu
  • MFC Feature Pack Tutorial – Part 1 – Getting started
  • MFC Feature Pack Tutorial – Part 2 – CMFCPropertySheet
  • MFC Feature Pack Tutorial – Part 3 – CMFCPropertyGridCtrl
  • What’s new in Visual Studio 2012 Solution Explorer
© 2012 bits and bytes Suffusion theme by Sayontan Sinha