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
 SQL Server Development (2000)
 SQL Server to Text

Author  Topic 

gouber
Starting Member

2 Posts

Posted - 2004-08-02 : 19:09:33
I would like to take information from SQL Server alter the data and then output it to a tab deliminated file. When I mean alter the data, I need to take information from two columns such as product id and category id then turn them into a URL. If the prodid is 1000 and the categoryid is 5 then the url that goes into the text doc would look something like http://www.address.com/p=1000&c=5. I am familar with the Data Transformation Service in SQL Server, I do not think that is going to work the way that I want. I think that I am going to have to loop through the sql. I was wondering if anyone already has some code that does something similar, it would save me lots of time.

Thanks,
TJ

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-08-02 : 19:35:24
Do a query along the lines of

SELECT 'http://www.address.com/p=' + Convert(varchar, ProductID) + '&c=' + Convert(varchar, CategoryID)
FROM table(s)


Then you can use BCP to extract the data to a text file. Check out BOL for more info on BCP. You also can use DTS if you want.

Go to Top of Page

gouber
Starting Member

2 Posts

Posted - 2004-08-03 : 13:34:55
I just realized that I will need the category heiarchy. I think that I am just going to have to loop through in code. Thanks for the suggestion, it looks like that would do for what I asked.

Later,
TJ
Go to Top of Page
   

- Advertisement -