Rank: Advanced Member
Groups: Registered
Joined: 7/1/2018(UTC) Posts: 64 ![_United States _United States](/Forums/Content/images/flags/US.png) 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](/Forums/Themes/Custom/heart_small.png) 1 user thanked Dustin Higgins for this useful post.
|
|
|
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.