Friday, March 9, 2012

Save a large string in database

hi

is there a datatype thatcan handel a very large string ( i dont want to save it in a file and save the file in the bd ) i want to save it as it is

thanx a lot

Varchar can hold 8000 characters now. Use Text for longer strings.|||Hi,

SQL Server 2005 introduced VARCHAR(MAX) which can hold up to 2^31 byte of data.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de|||

i use sql server 2000 and its has text and it can hold up to 2^31-1

but i need a bigger datatype

|||

TEXT and IMAGE columns both have the ~2GB limit that you have identified and there are, unfortunately, no other options available for you to store larger data directly in SQL Server 2000. This same limit will be hit with the varchar(max) column types in SQL Server 2005 that Jens mentioned previously.

If it's feasible, it would obviously be helpful to segment the data such that it can be stored in columns of this size. Failing that, I think you've identified a workable solution to store some kind of URI (UNC path, URL, etc.) and allow the client app to take care of retrieving the file as a separate "query".

|||+1 for the file approach as if you hit the limit you will have no other chance, but consider this paper for storing a BLOB in the database or on the file system.

http://research.microsoft.com/research/pubs/view.aspx?msr_tr_id=MSR-TR-2006-45

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment