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
 General SQL Server Forums
 New to SQL Server Programming
 Help with text files

Author  Topic 

avmreddy17
Posting Yak Master

180 Posts

Posted - 2007-10-09 : 17:41:14
Hi,

I have a table T1 with three Cols.
Code VARCHAR(10),
INISetting TEXT,
TSystem VARCHAR(10).

Right now I are storing the INI Files directly in the database.
I would like to move this to text files in to a SAN box and just store the Pointers in the IniSetting Column and name the text files
some thing like Code.txt

When I do a SELECT Code , INISetting , TSystem FROM T1.

I want to read the Contents as is from the Text files stored in the SAN Box?.

Can some one help me with this.

Thanks
Venu

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-10-09 : 22:00:10
You can get file path and name with select statement, then open file with dos command.
Go to Top of Page

avmreddy17
Posting Yak Master

180 Posts

Posted - 2007-10-09 : 23:08:05
Currently, my INSetting Column ( TEXT Column ) has data like the format shown below. When I BCP the data out to a text file, Is it possible that I can have the same format as is. When I BCP'ed out
all the data is comming in the single line.


[FixDispatcher]
PrimaryMachine=XX.XX.XX.XX
Port=5012
FirmID = 001
TargetSystem=BOMS

SecondaryMachine=XX.XX.XX.XX
SecondaryPort=5012

[DQK]
Enabled = 1
LCV = 10
ECV = 10
BCV = 10

[OPTMDS_IP_SETTINGS]
ABCDEF:P:XX.XX.XX.XX:7002
ABCDEF:B:XX.XX.XX.XX:7002
GHIJKL:P:XX.XX.XX.XX:7003
GHIJKL:B:XX.XX.XX.XX:7003
MNOPQR:P:XX.XX.XX.XX:7004
MNOPQR:B:XX.XX.XX.XX:7004
STUVWXYZ:P:XX.XX.XX.XX:7005
STUVWXYZ:B:XX.XX.XX.XX:7005


[MDS_IP_SETTINGS]
XX.XX.XX.XX:7000
XX.XX.XX.XX:7000
XX.XX.XX.XX:7000
XX.XX.XX.XX:7000
XX.XX.XX.XX:7000


[HDSDATA]
Address = XX.XX.XX.XX
port = 7001


[FTPDownload]
servername=XX.X.X.XX
username=ctos
password=zxcvbnm
targetversionfilename=version.ini
sourceversionfilepath=Firm215/version.ini
targetexefilename=CTSWS.exe
sourceexefilepath=Firm215/CTSWS.exe
bytestoread=2048
autoclose=1
checkversion=1

Thanks
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-10-09 : 23:29:15
Don't think you'll get same format in bcp.
Go to Top of Page

avmreddy17
Posting Yak Master

180 Posts

Posted - 2007-10-10 : 00:00:31
rmaio,

I am using filesystemObject and got the required format.

if I move all the INI Setting from a table to text file , Is it possible to read the text file from a Particular location in the Select Statement.

Some kind of function where you pass the location of the file and it reads in the same format as give above.

Thanks


Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-10 : 00:16:33
You can probably access a Text File using OPENROWSET

See Books Online for details.

Kristen
Go to Top of Page
   

- Advertisement -