Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
milagro
Starting Member
7 Posts |
Posted - 2011-05-18 : 08:30:32
|
| looking for some help with a query for all servers and MS software installed. Duplicate entries for each server is making it longer then necessary. I was trying to group the servers by name, so that the initial report is smaller and then be able to click on the server to see all the MS software installed. SELECT DISTINCT RSYS.Netbios_Name0, RSYS.AD_Site_Name0, OPSYS.Caption0, OPSYS.Version0, OPSYS.CSDVersion0,ISC.ProductName0,OPSYS.Description0FROM v_FullCollectionMembership SYSJOIN v_GS_OPERATING_SYSTEM OPSYS on SYS.ResourceID=OPSYS.ResourceIDJOIN v_R_System RSYS onSYS.ResourceID=RSYS.ResourceIDJOIN v_GS_INSTALLED_SOFTWARE_CATEGORIZED ISCon RSYS.ResourceID=ISC.ResourceIDWHERE OPSYS.Caption0 LIKE '%Server%' AND SYS.CollectionID = 'PDC02288'AND ISC.ProductName0 like 'Microsoft%'GROUP BY RSYS.Netbios_Name0, RSYS.AD_Site_Name0ORDER BY RSYS.Netbios_Name0,OPSYS.Caption0When I run this, it errors out with a message that column'v_gs_operating_system.caption0' is invalid in the select list because it's not in an aggregate function or the GROUP BY clause.Any help is appreciated, thanks. |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-05-18 : 08:35:35
|
| select * from (SELECT DISTINCT RSYS.Netbios_Name0, RSYS.AD_Site_Name0, OPSYS.Caption0, OPSYS.Version0, OPSYS.CSDVersion0,ISC.ProductName0,OPSYS.Description0, seq = ROW_NUMBER() over (partition by RSYS.Netbios_Name0,RSYS.AD_Site_Name0 order by OPSYS.Caption0)FROM v_FullCollectionMembership SYSJOIN v_GS_OPERATING_SYSTEM OPSYS on SYS.ResourceID=OPSYS.ResourceIDJOIN v_R_System RSYS onSYS.ResourceID=RSYS.ResourceIDJOIN v_GS_INSTALLED_SOFTWARE_CATEGORIZED ISCon RSYS.ResourceID=ISC.ResourceIDWHERE OPSYS.Caption0 LIKE '%Server%' AND SYS.CollectionID = 'PDC02288'AND ISC.ProductName0 like 'Microsoft%') awhere seq = 1ORDER BY RSYS.Netbios_Name0,OPSYS.Caption0==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
milagro
Starting Member
7 Posts |
Posted - 2011-05-18 : 09:16:52
|
| tried this but get "RSYS.Netbios_Name0 could not be bound. I am still working to correct this. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-05-18 : 09:51:36
|
| Sorry - it's just the order byselect * from (SELECT DISTINCT RSYS.Netbios_Name0, RSYS.AD_Site_Name0, OPSYS.Caption0, OPSYS.Version0, OPSYS.CSDVersion0,ISC.ProductName0,OPSYS.Description0, seq = ROW_NUMBER() over (partition by RSYS.Netbios_Name0,RSYS.AD_Site_Name0 order by OPSYS.Caption0)FROM v_FullCollectionMembership SYSJOIN v_GS_OPERATING_SYSTEM OPSYS on SYS.ResourceID=OPSYS.ResourceIDJOIN v_R_System RSYS onSYS.ResourceID=RSYS.ResourceIDJOIN v_GS_INSTALLED_SOFTWARE_CATEGORIZED ISCon RSYS.ResourceID=ISC.ResourceIDWHERE OPSYS.Caption0 LIKE '%Server%' AND SYS.CollectionID = 'PDC02288'AND ISC.ProductName0 like 'Microsoft%') awhere seq = 1ORDER BY Netbios_Name0,Caption0==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
milagro
Starting Member
7 Posts |
Posted - 2011-05-18 : 12:56:13
|
| somehow I end up missing have of the servers. Going to start over to get the total number of servers and then maybe repost. appreciate the help. |
 |
|
|
|
|
|
|
|