|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Storing text files in a columnHello,
I'm trying to store an HTML page inside a table column (for debugging purposes). I tried the varchar type but 8000 chars are way to few for this. Then I turned to the text datatype and I learnt that while in a stored procedure that say inserts a line using a text type variable you shouldn't specify a size for it, so just "@content TEXT". Problem is, Enterprise Manager fills in a default length of 16 for the text column which I am unable to modify. The result of this (I think) is that no matter what I insert in there, it's always at most 16 characters. Any solution to this(sql server solution I mean, not dumping the file to disk instead)? Thank you. Creating procedures is best done in Query Analyzer. How have you determined
that only 16 characters have been inserted? How are you invoking the procedure? ML --- http://milambda.blogspot.com/ the 16 bytes is actually a POINTER to actual data, so you cannot change its
size. however, handling TEXT datatype only for debugging purposes is in my opinion a little awkward. you'd better store these html pages in files and store only paths to these files in database. the advantage would be that you would be able to open the files directly from file system. if you have sql 2005 you can use large-value data type, like nvarchar(MAX) instead of ntext Peter Show quote "Gabriel Lacatus" <cyberdude@nospam.nospam> wrote in message news:OS86sEiWGHA.4452@TK2MSFTNGP04.phx.gbl... > Hello, > I'm trying to store an HTML page inside a table column (for debugging > purposes). > I tried the varchar type but 8000 chars are way to few for this. Then I > turned to the text datatype and I learnt that while in a stored procedure > that say inserts a line using a text type variable you shouldn't specify a > size for it, so just "@content TEXT". Problem is, Enterprise Manager fills > in a default length of 16 for the text column which I am unable to modify. > The result of this (I think) is that no matter what I insert in there, > it's always at most 16 characters. > > Any solution to this(sql server solution I mean, not dumping the file to > disk instead)? > > Thank you. > > size for it, so just "@content TEXT". Problem is, Enterprise Manager fills I'm going to suggest you not use Enterprise Manager for this stuff, and not > in a default length of 16 for the text column which I am unable to modify. rely on anything it tells you in the meantime. In this case, the 16 bytes is actually representing a pointer to the data, not the data itself. > The result of this (I think) is that no matter what I insert in there, No, you're incorrect. In the time it took you to send this post, you could > it's always at most 16 characters. have already tested it by inserting 17 characters (or 17,000 characters). In any case, I agree with the other sentiments. Store your files in the file system, that's what it's for. Now, data about your files, yes, that belongs in the database. http://www.aspfaq.com/2149 |
|||||||||||||||||||||||