macromedia.coldfusion.database_access
[Top] [All Lists]

Re: cfqueryparam and mssql

Subject: Re: cfqueryparam and mssql
From: Adam Cameron <adam_junk@xxxxxxxxxxx>
Date: Wed, 30 Jul 2008 09:27:23 +0100
Newsgroups: macromedia.coldfusion.database_access

>  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.

-- 
Adam

<Prev in Thread] Current Thread [Next in Thread>