Friday, February 24, 2012

Data Types

Hi...what would be the right data type to use for a field that will hold a
long description that will be keyed in by the user?
Currently, I have it set to use varchar with a size of 3000, but it still
cuts off.
Thanks> Currently, I have it set to use varchar with a size of 3000, but it still
quote:

> cuts off.

What does that mean? You are trying to store more than 3,000 characters, or
your stored procedure truncates the entry, or Query Analyzer doesn't show
the full entry, or something else ... ?
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/|||Hi,
SQL 2000 allows varchar with a max size of 8000. You can use ALTER TABLE
statement to increase the width from 3000 to 8000.
If your problem is just display then try selecting the data with out grid
(text format) option in query analyzer.
Thanks
Hari
MCDBA
"SQL" <nospam@.asdfadsf.com> wrote in message
news:uN9gJH06DHA.2656@.TK2MSFTNGP11.phx.gbl...
quote:

> Hi...what would be the right data type to use for a field that will hold a
> long description that will be keyed in by the user?
> Currently, I have it set to use varchar with a size of 3000, but it still
> cuts off.
> Thanks
>
|||Assuming this isn't a display issue and you consider this, be careful
,since inserts will then fail when the total length of a row exceeds
8060 bytes. Better to cut the information off than to create a
situation where inserts can cause an error condition. You could also
look into using the text data type. It's not as easy to manipulate
beyond inserts and retrieval, but can hold up to 2 Gig of information,
since it only stores a 16-byte text pointer in the row. If you can,
limit the amount of information inserted at the front end.
If it is a display issue, you will not only need to change the output to
text from grid, but you will also have to go into the Query Analyzer
Tools|Options|[Results] and set the "Maximum Characters per Column:"
value to match or exceed your varchar column length. The default is
256, I believe.
SK
Hari wrote:
quote:

>Hi,
>SQL 2000 allows varchar with a max size of 8000. You can use ALTER TABLE
>statement to increase the width from 3000 to 8000.
>
>If your problem is just display then try selecting the data with out grid
>(text format) option in query analyzer.
>Thanks
>Hari
>MCDBA
>"SQL" <nospam@.asdfadsf.com> wrote in message
>news:uN9gJH06DHA.2656@.TK2MSFTNGP11.phx.gbl...
>
>
>

No comments:

Post a Comment