开发者

Scalar Value Function returns VARCHAR(MAX) in C++ ADO (not .NET)

I created a scalar-valued function in MSSQL that returns VARCHAR(MAX).

I am using a CommandPtr (preCom) filled with the parameters for the function, and I am calling the function with the following call:

_variant_t vNull;
vNull.vt = VT_ERROR;
vNull.scode = DISP_E_PARAMNOTFOUND;
HRESULT hr = ptrCom->raw_Execute(&vNull, &vNull, adCmdStoredProc, &record_set);

The returned HRESULT is DB_E_ERRORSINCOMMAND.

If I change the returned value from VARCHAR(MAX) to VARCHAR(8000) everything works fine.

Does anyone have any idea how do I execute a 开发者_运维技巧scalar-valued function that returned VARCHAR(MAX) ?

Thanks!


See Updating an Application to SQL Server Native Client from MDAC:

When MDAC applications connect to SQL Server, the data types introduced in SQL Server 2005 will appear as SQL Server 2000-compatible data types as shown in the following table.

SQL Server 2005 type SQL Server 2000 type
varchar(max)         text

So I'd guess if you can specify text, it might work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜