Hi Guys ,
i have files which are of different sizes.How can i insert a text file which has more than 4000 characters in database .My table field is of type nvarchar so i cannot have more than 4000 characters ,is there a way around?

Change your field type to ntext or nvarchar(MAX), depending on which database you are using. If you regularly go over the 8KB limit, an alternative strategy is a good idea because the overflow paging of exceeding the limit with ntext or nvarchar(MAX) can have significant overhead.

Edward wrote a repository library using WCF that works with tickets and the file system on a repository server. It works very well when the tickets are stored in a database rather than actual data because the repository server can be queried with the ticket to return a memory stream. The repository was written because Ed was working on an image processing system where the stored data was often quite a bit larger than 8K, but it is general enough that the library has seen a lot of use in Ed's projects. ;)

Unfortunately, the code is not open for posting an example, but hopefully it gives you an idea for alternative storage strategies.

nvarchar(max) = 4000 character and i have more than that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.