> I'm a little confused about using cfqueryparam:
>
> 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?
use varchar & make sure you set the "Enable High ASCII characters and Unicode
for data sources configured for non-Latin characters" under advanced settings
for that dsn.
> 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.
But even if either would work, I think VARCHAR is more sensible because
it's the closest to the real situation.

Signature
Adam
GArlington - 30 Jul 2008 11:44 GMT
> > 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?
[quoted text clipped - 10 lines]
> 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...
jeremy@noble - 30 Jul 2008 17:22 GMT
Thanks for the help guys.
I tried both and they both seem to work the same as far as I can tell. If the
field is set to nvarchar they both input the same data. Entering one letter in
a 255 length field still only stores as one letter.
The only real value for me to use CF_SQL_CHAR is that it is just that much
less typing! I have to update an old site with 450+ queries to use
CFQUERYPARAM. Of course, most of them are nvarchar fields. I found a free
script that updates your pages but uses the default CF_SQL_CHAR. It would be
great to just use that and same me all the hassle.