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)
 query output to space delimited .DAT file

Author  Topic 

steelkilt
Constraint Violating Yak Guru

255 Posts

Posted - 2004-02-26 : 11:53:04
Hi, the code snippet below was put together originally with help from the team here.

This code resides in an ASP page, which sends parameters to an SPROC. the results of the sproc are kicked back to an html page and are also saved to a server folder.

Any ideas on how to modify the code to deliver space delimited output file as opposed to tab-delimited? thx

============================================showblank=""
shownull="<null>"
linestart=chr(34)
lineend= vbCRLF 'This is changed from the original


data=data & lineend & rstemp.GetString()


Set fstemp = server.CreateObject("Scripting.FileSystemObject")
Set filetemp = fstemp.CreateTextFile(whichFN, true)

filetemp.Write(Left(data, Len(data)-Len(linestart))) 'trims the last linestart value and writes the file


SamC
White Water Yakist

3467 Posts

Posted - 2004-02-26 : 12:03:38
I'd like to see some of the sproc and how it's called from ASP.

What about using REPLACE in ASP to change tabs to spaces?
Go to Top of Page

steelkilt
Constraint Violating Yak Guru

255 Posts

Posted - 2004-02-27 : 11:25:28
using this in ASP script

linestart=""
lineend=""
delimiter=chr(32)
delimitersub=chr(32)

does the trick. went back to learnasp.com for a fresh look at the original code. The point of this exercise is to end up with a text file that is usable in SAS, i.e. the data as it exists in the db needs to be formatted properly before SAS will take it.

so, this is what the app does:

-- user picks fields, filters, and table to run against from web form

-- form submission triggers SPROC, which gathers parameters and filters data accordingly

-- query results returned to ASP page, where space-delimited text file is created. text file values are updated via ASP script to make them SAS-friendly, then text file is written to shared location.

Cheers.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-02-27 : 12:16:50
Why can't you use bcp?

Also it's space delimited, but is it fixed width char?



Brett

8-)
Go to Top of Page
   

- Advertisement -