Ad Space here

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Share
Options
Go to last post Go to first unread
Dustin Higgins  
#1 Posted : Friday, December 21, 2018 8:41:02 AM(UTC)
Dustin Higgins

Rank: Advanced Member

Groups: Registered
Joined: 7/1/2018(UTC)
Posts: 64
_United States

Thanks: 1 times
Was thanked: 6 time(s) in 6 post(s)
Ever get tired of looking around database tables in SCCM for field names, etc. Here is a couple simple queries that can be used easily in PowerShell to create CSVs for all of the tables:

Use this one to get a list of the tables:

"SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ORDER BY TABLE_NAME"

Loop through the tables and run this query (export the results to csv):

"SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME=`'" + $tableName + "`' ORDER BY COLUMN_NAME"

This is not the entire PowerShell code, but just the idea of what queries to run.
thanks 1 user thanked Dustin Higgins for this useful post.
Mike Merola on 2/29/2020(UTC)
Sponsor
Ad Space here
Rss Feed  Atom Feed
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.