SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 transpose rows to colms
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bvv
Starting Member

1 Posts

Posted - 08/28/2014 :  12:24:24  Show Profile  Reply with Quote
hi there,

i would like to reach out you on transposing rows to cols.

Format:
NodeName|upsBasicIdentName|upsBasicIdentModel | upsAdvIdentSerialNumber | upsAdvIdentDateOfManufacture | upsBasicBatteryLastReplaceDate


i have this query. the values of each are under status. thank you for your help!

SELECT
Nodes.Caption AS NodeName, CustomNodePollers_CustomPollers.MIB AS MIB, CustomNodePollerStatus_CustomPollerStatus.Status AS Status

FROM

((Nodes INNER JOIN CustomPollerAssignment CustomNodePollerAssignment_CustomPollerAssignment ON (Nodes.NodeID = CustomNodePollerAssignment_CustomPollerAssignment.NodeID)) INNER JOIN CustomPollers CustomNodePollers_CustomPollers ON (CustomNodePollerAssignment_CustomPollerAssignment.CustomPollerID = CustomNodePollers_CustomPollers.CustomPollerID)) INNER JOIN CustomPollerStatus CustomNodePollerStatus_CustomPollerStatus ON (CustomNodePollerAssignment_CustomPollerAssignment.CustomPollerAssignmentID = CustomNodePollerStatus_CustomPollerStatus.CustomPollerAssignmentID)

WHERE
(
(CustomNodePollers_CustomPollers.MIB like 'PowerNet-MIB:upsBasicIdentName') Or
(CustomNodePollers_CustomPollers.MIB like 'PowerNet-MIB:upsBasicIdentModel') Or
(CustomNodePollers_CustomPollers.MIB like 'PowerNet-MIB:upsAdvIdentSerialNumber') Or (CustomNodePollers_CustomPollers.MIB like 'PowerNet-MIB:upsAdvIdentDateOfManufacture') Or (CustomNodePollers_CustomPollers.MIB like 'PowerNet-MIB:upsBasicBatteryLastReplaceDate')
)

gbritton
Flowing Fount of Yak Knowledge

1182 Posts

Posted - 08/29/2014 :  07:54:23  Show Profile  Reply with Quote
read up on PIVOT
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000