question

DucheminDominique-7551 avatar image
0 Votes"
DucheminDominique-7551 asked Garth edited

SQL versus WQL

Hello,

I have a SQL query:


select sys.name0, Creation_Date0, os.Caption0,WINSPrimaryServer0, WINSSecondaryServer0 from v_R_System sys
join v_GS_NETWORK_ADAPTER_CONFIGUR NAC on NAc.ResourceID=sys.ResourceID
join v_GS_OPERATING_SYSTEM os on os.ResourceID=sys.ResourceID
join v_FullCollectionMembership col on col.ResourceID = sys.ResourceID
where
OS.Caption0 like '%server%'
and nac.IPEnabled0='1'
and col.CollectionID = 'UCP00242'
and (NAC.WINSPrimaryServer0 IS NULL)
or NAC.WINSSecondaryServer0 IS NULL)
order by Name0 ASC


and a WQL for the collection


select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System
inner join SMS_G_System_NETWORK_ADAPTER_CONFIGURATION on SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.ResourceID = SMS_R_System.ResourceId where
SMS_R_System.OperatingSystemNameandVersion like "%server%" and SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.IPEnabled = 1 and SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.WINSPrimaryServer is null and SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.WINSSecondaryServer is null



I have a result of 216 items in SQL and 192 only in the WQL. I noticed in SQL there are some servers which appear multiple time… but I am not sure how to identify them versus the collection which is displaying only 1 item per server.

Thanks,
Dom

mem-cm-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AllenLiu-MSFT avatar image
0 Votes"
AllenLiu-MSFT answered DucheminDominique-7551 commented

Hi, @DucheminDominique-7551

Thank you for posting in Microsoft Q&A forum.

The conditions in your SQL query is (NAC.WINSPrimaryServer0 IS NULL or NAC.WINSSecondaryServer0 IS NULL) means we need one of the two is NULL or both to be NULL.

The conditions in the WQL
SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.WINSPrimaryServer is null and SMS_G_System_NETWORK_ADAPTER_CONFIGURATION.WINSSecondaryServer is null
means we only need both to be NULL.



If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Is there any update on this thread?

0 Votes 0 ·

Hello,

Let me check as I did not get a chance to do it yet....

Thanks,
Dom

0 Votes 0 ·
Garth avatar image
0 Votes"
Garth answered Garth edited

Your queries are not the same for everything. For example you are looking at os name from r system in one case and os in another.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.