Video Screencast Help
Search Video Help Close Back
to help
New in the Rewards Catalog: Vouchers for "Symantec Technical Specialist" and "Symantec Certified Specialist" exams.

SQL Query Help - Custom Collection

Updated: 21 May 2010 | 2 comments
SegaAges's picture
0 0 Votes
Login to vote
This issue has been solved. See solution.

Hi All,

I'm trying to create a custom collection that only includes the computer name, the computer type (which I only want laptops), and is in a specific OU.  It seems simple enough, and my query works PERFECT in SQL Query Analyzer, but when I plug it into the Custom SQL in Altiris, it returns every record of everything, i.e. software, user names, computer names, everything!

Here is the query:

SELECT     
Inv_OU_Membership.[Distinguished Name],
Inv_AeX_HW_Serial_Number.[Computer Type],
Inv_AeX_AC_Identification.[Name], 
Inv_AeX_AC_Identification.[_ResourceGuid]

From Inv_AeX_AC_Identification  
     
left join Inv_AeX_HW_Serial_Number     
on Inv_AeX_AC_Identification.[_ResourceGuid]=Inv_AeX_HW_Serial_Number.[_ResourceGuid]   
left join Inv_OU_Membership   
on Inv_AeX_AC_Identification.[_ResourceGuid]=Inv_OU_Membership.[_ResourceGuid]     
where    
(Inv_AeX_HW_Serial_Number.[Computer Type] LIKE 'Portable' or    
Inv_AeX_HW_Serial_Number.[Computer Type] LIKE 'Notebook' or    
Inv_AeX_HW_Serial_Number.[Computer Type] LIKE 'Laptop')    
and (( Inv_OU_Membership.[Distinguished Name] = 'OU=TEMECULA,OU=WEST COAST,OU=NORTH AMERICA,OU=ENTERPRISE,DC=CORP,DC=MILLIPORE,DC=COM'))

Can someone help me figure out what I can be doing wrong ?  I really appreciate it!  

Thanks,

-Nick

Comments

Robert Lundsten's picture
01
Oct
2009
0 Votes 0
Login to vote

You need to return the Guid...

Hey Nick!

Collection queries in Altiris need an Guid returned. Otherwise it does not know what to display. Crazy? Yes, I know :)

Here is a working query;

SELECT    
Inv_AeX_AC_Identification.[_ResourceGuid] AS Guid
From Inv_AeX_AC_Identification 
left join Inv_AeX_HW_Serial_Number    
on Inv_AeX_AC_Identification.[_ResourceGuid]=Inv_AeX_HW_Serial_Number.[_ResourceGuid]  
left join Inv_OU_Membership  
on Inv_AeX_AC_Identification.[_ResourceGuid]=Inv_OU_Membership.[_ResourceGuid]    
where   
(Inv_AeX_HW_Serial_Number.[Computer Type] LIKE 'Portable' or   
Inv_AeX_HW_Serial_Number.[Computer Type] LIKE 'Notebook' or   
Inv_AeX_HW_Serial_Number.[Computer Type] LIKE 'Laptop')   
and (( Inv_OU_Membership.[Distinguished Name] = 'OU=TEMECULA,OU=WEST COAST,OU=NORTH AMERICA,OU=ENTERPRISE,DC=CORP,DC=MILLIPORE,DC=COM'))

Hope it helps!

Robert Lundsten
Consultant / Founder : Asterio

Homepage | http://www.asterio.se
Blog | http://www.asterio.se/blogg
Twitter | http://twitter.com/asterioan

SegaAges's picture
02
Oct
2009
0 Votes 0
Login to vote

Hey Robert, I can't believe

Hey Robert,

I can't believe how easy that was...  I am fairly new to Altiris, but I have searched and searched, and just last night realized there was a special way to write collection SQL query's.  Do you know if there is any documentation that describes exactly how to do it, or is it just the same as normal SQL, but you have to include the GUID ? 

That query worked like a charm, you have saved me soooo much heart ache, thank you !!!

Take care,

-Nick