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.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Automate Result Export from SQL Server Management

Author  Topic 

vlfoley
Starting Member

6 Posts

Posted - 2011-05-12 : 09:40:11
I am using Microsoft SQL Server MAnagement Studio 2005 and I need to get some results automatically exported to Excel. How can I do this?

Here is oneof the queries I'm using, it's very simple, not a whole lot of data.

select userid from maxuser where status = 'active' and type = 'Primary'

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-05-12 : 10:08:46
Take a look at Madhivanan's blog here and see if that helps you: http://beyondrelational.com/blogs/madhivanan/archive/2007/08/27/import-export-to-excel.aspx

To automate it, you will need to set up a SQL server agent job.
Go to Top of Page

vlfoley
Starting Member

6 Posts

Posted - 2011-05-12 : 10:28:07
How do I set up a SQL server agent job?
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-05-12 : 10:44:43
Take a look at these pages, they have step by step instructions:

http://msdn.microsoft.com/en-us/library/ms187910(v=SQL.90).aspx
http://msdn.microsoft.com/en-us/library/ms190268(v=SQL.90).aspx
Go to Top of Page

vlfoley
Starting Member

6 Posts

Posted - 2011-05-12 : 11:24:50
I don't have the proper permissions to do this. I'm remote desktop connecting to the server and accessing SQL server that way. Is there any other way I can automate this?
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-05-12 : 12:19:03
Even if you are on a remote box connecting using SQL Server Management Studio, you can do this IF you have the proper permissions. But, if you don't have the proper permissions, you cannot - even if you are on the same box as the server.

You probably need to get the permissions from your DBA. Alternatively, you might consider using the windows scheduler to run a bat file. But, for various reasons, it would be preferable to schedule it using Agent. If you have an enterprise job scheduler (such as Active Batch) at your location you may want to consider that.
Go to Top of Page
   

- Advertisement -