|
|
On Jul 30, 9:27 am, Adam Cameron <adam_j...@xxxxxxxxxxx> wrote:
> > I know the defualt CFSQLTYPE is CF_SQL_CHAR. Most of my fields are
> > nvarchar,
> > so would I HAVE to use CF_SQL_VARCHAR? Or would CF_SQL_CHAR work as well?
>
> You should use VARCHAR. The CHAR / VARCHAR thing is to do with the size of
> the storage, not what's being stored. A CHAR field occupies the size
> specified, irrespective of what you put in it. If you ahve a CHAR(10) and
> put 'A' in it: it still uses 10 bytes. In a VARCHAR(10) it would only take
> one byte.
>
> That said, from a JDBC perspective, I'm pretty sure it wouldn't matter,
> because I think the validation done is just for type of data (and both are
> character data) and size (and as long as it's within the max you specify:
> fine). And the unicode-ness of the data doesn't seem to come into it
> either. Someone might correct me on that.
I think that I have seen a very hard to solve problem with DB using
fixed size char(size) for field definition and CF (or maybe some other
language) passing the value as string. AFAIR the driver [JDBC?] was
failing with NOT very clear error message because the LENGTH of the
string was NOT the same as size of DB field...
>
> But even if either would work, I think VARCHAR is more sensible because
> it's the closest to the real situation.
>
> --
> Adam
I am using varchar(size) everywhere and very happy with it...
|
|