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 |
mqh7
Yak Posting Veteran
58 Posts |
Posted - 2012-08-16 : 11:20:20
|
On this site I've seen some posts about exporting data to Excel. From the SQL server when I run a report I go to the bottom half of the screen where the results are, highlight them all and pick "copy with headers". then I paste them into Excel. But how do you "execute" your code and have it auto-export into Excel 2010? I've read so much code on this it got confusing.This code works.select distinct gs.name0 AS [PC Name],gs.username0 AS [User Name],sr.serialnumber0 AS [Serial Number],dn.domain0 AS [Domain],ad.ad_site_name0 AS [Site Name],CASE WHEN ad.Obsolete0 = 0 then 'Healthy' WHEN ad.Obsolete0 = 1 then 'Obsolete' ELSE 'NULL' END AS [Client Health],ad.Operating_System_Name_and0 AS [OS Type]FROM v_gs_computer_system gs INNER JOIN v_GS_SYSTEM_ENCLOSURE sr ON gs.resourceID = sr.ResourceID INNER JOIN v_GS_SYSTEM dn ON sr.ResourceID = dn.ResourceIDINNER JOIN v_R_System ad ON dn.ResourceID = ad.ResourceIDwhat do you add in terms of code to have this auto export into Excel 2010? |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|