|
Home > Archive > ASE Database forum > October 2005 > converting from Text to varchar?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
converting from Text to varchar?
|
|
|
| How can I convert a field from Text to varchar? I want to
retrieve the first N chars from this Text field, and I
assume that the only way is to convert it to string so that
I can use its functions.
Thanks.
| |
| Carl Kayser 2005-10-31, 9:24 am |
| select varchar_val = convert (varchar (N), text_val)
Or "update ... set", etc. with columns or variables.
<VMI> wrote in message news:4366247a.554b.1681692777@sybase.com...
> How can I convert a field from Text to varchar? I want to
> retrieve the first N chars from this Text field, and I
> assume that the only way is to convert it to string so that
> I can use its functions.
>
> Thanks.
| |
|
| Most strings in the field are greater than the max (255) num
of chars.
Is there another possible solution?
THanks.
> select varchar_val = convert (varchar (N), text_val)
>
> Or "update ... set", etc. with columns or variables.
>
> <VMI> wrote in message
> can use its functions. >
>
>
| |
| Bret Halford 2005-10-31, 11:24 am |
| Upgrade to 12.5.x or 15.x, where the maximum number of
characters for a variable goes to 16K (and the maximum number
for a column is based on the page size of the server).
You can also limit the amount of data selected from a TEXT or
IMAGE column with the SET TEXTSIZE command. The default
is 32K
VMI wrote:
[color=darkred]
> Most strings in the field are greater than the max (255) num
> of chars.
> Is there another possible solution?
>
> THanks.
>
| |
| Carl Kayser 2005-10-31, 11:24 am |
| <VMI> wrote in message news:43665041.59db.1681692777@sybase.com...[color=darkred]
> Most strings in the field are greater than the max (255) num
> of chars.
> Is there another possible solution?
>
> THanks.
>
>
Well, you didn't specify your server version. If you are on 12.5.0 then you
can have, at a minimum, a varchar (1,962) column. (But you are still
limited to a 2,000 wide table width, unless you use a pagesize greater than
2K.) Depending upon the server pagesize, it could be as large as 16,384.
Variables can be as large as varchar (16,384) regardless of the pagesize.
So consider upgrading your server if you are on an older version.
|
|
|
|
|