3

I'm in the process of updating MS-SQL table structures to use nvarchar(max) instead of the text datatype.

Previously, for my ColdFusion queries using the text datatype, I used cfsqltype="CF_SQL_LONGVARCHAR":

<cfquery name="local.qryUpdateByPK" datasource="#local.dsn#">
UPDATE
    [JobPosting]
SET
    [JobDescription] = <cfqueryparam value="#arguments.JobDescription#" cfsqltype="CF_SQL_LONGVARCHAR" null="#YesNoFormat(NOT Len(Trim(arguments.JobDescription)))#">
WHERE
    [JobPostingID] = <cfqueryparam value="#arguments.JobPostingID#" cfsqltype="CF_SQL_INTEGER">
</cfquery>

I'm wondering what should be used for the cfsqltype attribute when using nvarchar(max) or varchar(max).

WillardSolutions
  • 2,316
  • 4
  • 28
  • 38
Scott Jibben
  • 2,229
  • 1
  • 14
  • 22

1 Answers1

4

If memory serves, information on the nvarchar support was a bit sketchy in the main Adobe documentation last I checked. However, the correct sqltype for nvarchar(max) is CF_SQL_LONGNVARCHAR.

Update:

The new types are mentioned briefly in Database Enhancements for CF10

New data type support for CFSQLType

The cfqueryparam and cfprocparam tags support the following SQL types:

  • CF_SQL_NCHAR
  • CF_SQL_NVARCHAR
  • CF_SQL_LONGNVARCHAR
  • CF_SQL_NCLOB
  • CF_SQL_SQLXML
Community
  • 1
  • 1
Leigh
  • 28,765
  • 10
  • 55
  • 103