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 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Generate the data and place in the respective loc

Author  Topic 

sqlserverdeveloper
Posting Yak Master

243 Posts

Posted - 2008-06-02 : 17:02:01
I have a stored proc, once the stored proc runs it generates data with respect to different categories for example below is sample data:
category1 101
category2 103
category1 106
category3 100
category2 110
etc
So what I want is place the respective data into the folder wheer it belongs to on the network, for example I want to place all the info of category1 in category1 folder, all the information of category2 in the category2 folder etc...
This will run as a scheduled job every morning, please advice how I can do this. Thanks!!

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-06-02 : 19:57:49
Do you mean dump data to different folder? You can use bcp for that if so, ensure sql agent service account has permission to create file in those folders.
Go to Top of Page

sqlserverdeveloper
Posting Yak Master

243 Posts

Posted - 2008-06-03 : 16:40:03
Thanks for the response,
the output should go in excel format to each category folder.
The following is the resultset from the stored proc execution:
Column1 Column2 Column3
category1 101 NY
category2 103 Florida
category1 106 Colorado
category3 100 Georgia
category2 110 NJ
category3 200 Minnesota

We will have folders with the follow names:
category1, category2, category3 ... upto category60
Since we have 60 categories, so we will have 60 folders.
Per the above resultset,
1. The following data should go into category1 folder in excel format:
Column2 Column3
101 NY
106 Colorado

2. The following data should go into category2 folder in excel format:
Column2 Column3
103 Florida
110 NJ

Etc...
Please let me know how we can do this as I want to schedule this to run daily morning.
Thanks!!

Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-06-03 : 16:50:24
You can run bcp in sql job, find detailed syntax in books online.
Go to Top of Page
   

- Advertisement -