running stored procedures/returning data to excel

CREATE STORED PROC WITH PARAMETER
Use test
GO

CREATE PROC dbo.excel

@input varchar(100)
AS

select GETDATE() AS field1

GO
SET UP CONNECTION IN EXCEL

1. open excel
2. data ribbon
3. from other sources
4. from microsoft query
5. new data source
6. name your data source
7. sql server driver
8. connect
9. server name
10. untick ‘use trusted connection’ or leave it and skip next step
11. enter sql server username and password
12. pick any table from the list provided
13. tick save user id and password
14. ok
15. ok
16. select any 1 column for your query
17. next, next, next, finish
18. You should now be on the import data diaglogue box
19. properties
20. definition tab
21. change your command text to exec test.dbo.excel ?
22. ok, ok, enter password,options, select database, ok

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: