Jump to content




Sign in to follow this  
boyjaew2

Query - TOO many columns displayed



Recommended Posts

I have a query built to find a particular software installed. It takes FOREVER to run and spits back way too much. Below is my query. I barely understand these things and I must be doing something wrong here. I only need a few coulumns. I guess it will work for my end goal which will be a collection based on this query. It just seems a little verbose. It's basically giving me back every attribute. All I really want is:

 

System Resources.Active Directory Site Name

System Resource.Name

System Resource.Last Logon User Name

System Resource.Machine Assigned to User

Installed Software.Product Name

Installed Software.Product Version

Installed Software.Publishers

 

Also, is there really no way to deselect multiple columns after the results are displayed or is one at a time the only way?

 

Any help would be much appreciated.

 

select * from SMS_R_System inner join SMS_G_System_INSTALLED_SOFTWARE on SMS_G_System_INSTALLED_SOFTWARE.ResourceId = SMS_R_System.ResourceId where SMS_G_System_INSTALLED_SOFTWARE.ProductName = "Cabinet"

 

 

Share this post


Link to post
Share on other sites


Answered my own question, posting in case there are any other "query noobs" looking for a hint. Please comment if you have anything to add or any corrections.

 

My original post kinda answers this. My process looked like this

 

Queries>Create Query (this puts you in the "Query Design" view)

Name - something that makes sense

Limit to collection - if you want to limit set that here

Object Type - System Resource

Edit Query Statement

General tab

r-click in whitespace> New>Select

The first attribute I wanted was System Resources.Active Directory Site Name

Attribute class:System Resource

Alias as: <No Alias> - not sure how this works yet

Attribute:Active Directory Site Name

click "Ok"

click "Ok"

You'll see the first attribute set. The rest follow the same pattern. This all seems silly and obvious in retrospect, but hey, if it helps someone. I don't mind seeming silly. Since I was looking for specific software I added where SMS_G_System_INSTALLED_SOFTWARE.ProductName = "Cabinet" to the end of the query. I admit it was a shot in the dark, but it worked. This gave me back just the info I wanted and prevented my console from hanging while it found every single attribute most of which I didn't want.

 

Here's what I ended up with:

select SMS_R_System.Name, SMS_R_System.ADSiteName, SMS_R_System.LastLogonUserName, SMS_R_System.IsAssignedToUser, SMS_G_System_INSTALLED_SOFTWARE.ProductName, SMS_G_System_INSTALLED_SOFTWARE.ProductVersion, SMS_G_System_INSTALLED_SOFTWARE.Publisher from SMS_R_System inner join SMS_G_System_INSTALLED_SOFTWARE on SMS_G_System_INSTALLED_SOFTWARE.ResourceID = SMS_R_System.ResourceId where SMS_G_System_INSTALLED_SOFTWARE.ProductName = "Cabinet"

 

 

Hope it helps anyone that was in the same situation.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


×