Using Text File to Store User Data vs. Database

V

vunet.us

I want to know if this practice is effective and secure:
I have been thinking about storing some data, which my users upload,
in text files rather than database, since often I do not know how much
information users submit for things like item description or images
URL paths. This information may be very short or very long. MS SQL
Server requires a maximum field length to be set. Thus, if user enters
5 characters into 5000 character field, a lot of space will be wasted.
On the other hand, the database reference would point to the text
files to read users' data and display it on page.
So, please, share your opinion or experience about this technique.
Thanks.
 
B

Bob Barrows [MVP]

I want to know if this practice is effective and secure:

It depends. If you will need multi-user updates of this text file, then
forget the idea and use a database.
I have been thinking about storing some data, which my users upload,
in text files rather than database, since often I do not know how much
information users submit for things like item description or images
URL paths. This information may be very short or very long. MS SQL
Server requires a maximum field length to be set. Thus, if user enters
5 characters into 5000 character field, a lot of space will be wasted.

No it won't - not if you use a varchar or nvarchar datatype. Spaces are
only appended with char and nchar datatypes.
You also have the possibility of using a text datataype, which is
similar to the Memo datatype in Access. Personally, I would avoid this
if not needed (varchar datatype can hold up to 8000 characters).
On the other hand, the database reference would point to the text
files to read users' data and display it on page.
So, please, share your opinion or experience about this technique.
Thanks.

There is no need for it.
Problems include:
as stated earlier: concurrent, multi-user access to a text file is
impossible.
backups
keeping the database file references in sync with the file locations
role-based security is more diffiicult
 
V

vunet.us

It depends. If you will need multi-user updates of this text file, then
forget the idea and use a database.


No it won't - not if you use a varchar or nvarchar datatype. Spaces are
only appended with char and nchar datatypes.
You also have the possibility of using a text datataype, which is
similar to the Memo datatype in Access. Personally, I would avoid this
if not needed (varchar datatype can hold up to 8000 characters).


There is no need for it.
Problems include:
as stated earlier: concurrent, multi-user access to a text file is
impossible.
backups
keeping the database file references in sync with the file locations
role-based security is more diffiicult

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Thank you very much for important input.
So, you say that if I use data type varchar with 8000 characters and
user enters 4 characters in, all remaining 7996 characters will not be
stored and used by databse?
Is Memo datatype in Access the same thing as varchar in MSSQL DB?
Thanks.
 
B

Bob Barrows [MVP]

Thank you very much for important input.
So, you say that if I use data type varchar with 8000 characters and
user enters 4 characters in, all remaining 7996 characters will not be
stored and used by databse?

I think that's exactly what I said.
Varchar columns use a couple extra bytes to store the number of
characters actually stored in each row.
Is Memo datatype in Access the same thing as varchar in MSSQL DB?

No. As I said, the Text datatype in sql server is equivalent to the Memo
datatype in Access.

SQL Server varchar is similar to the Text datatype in Access.

You may find this helpful:
http://www.aspfaq.com/show.asp?id=2229
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top