cancel
Showing results for 
Search instead for 
Did you mean: 

How to store a text file in SQL Server?

Former Member
0 Kudos

Dear All,

I Would like to know is it possible to store a .txt file in SQL Server 2005. if so can u please explain me the procedrue and query to do it

Regards

Tamilarasi

Technical Consultant SAP Business One

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

What do you want exactly?

Create on sql server txt file through TSQL? or Store txt file on server?

If is it the seccond option (store existing file), you should store it in field as binary type.

Let me know

Former Member
0 Kudos

...hmm...my gut feeling tells me that it could be not a good idea to store files of unknown size in DB because of DB-Performance - even when theres a way to do it. But maybe I'm wrong with that.

What about...

1. ...a DB-column of type db_Memo (if 64000 characters are enough...)?

2. ...or creating a folder on B1_Shr where the Textfiles are moved to and only store the (unique) filenames in DB the folder actually contains?

No. 2. needs some logic to keep the folder and DB-entrys always in sync.

Just my thoughts...

Former Member
0 Kudos

You could create a Table outside of B1 and use nvarchar(max) to save the text from your text file.

...as long as you know this table will not move with you Patch Level upgrads.

Rune

Former Member
0 Kudos

Dear Peter,

I want to store a txt file in sql server using SAPbobsCOM.Recordset.

Regards,

Tamizharasi.S

Former Member
0 Kudos

ok, Im not sure if I understand you correctly, but Ill try explain all ways:

You have for example file file.txt

1. You could store this file somewhere and to db write just path to this file.

2. You want store the textfile (inside datas) into db structures as

insert into table (file) values ('all datas what are inside the file') - the file column must be text or binary type

3. create directly on sql server text file - look at http://www.simple-talk.com/sql/t-sql-programming/reading-and-writing-files-in-sql-server-using-t-sql...

hope it helps