???? ID: 269011 - ????? ???????: 03 ?????? 2010 - ??????: 2.0
BUG: ?????? 22018 "?????? ???? ??? cast ???????? ?? ???" SQL Server 6.5 ?? ???
?????? ?????? This article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.
?? ??? ODBC API ????? ????
SQLExecute ?????? ?? ??? ???? ?? ??? ??? ???????? ????????? ?? ??? ????
sp_getbindtoken ?? ?? fires ?????? ?? ??? ???? ?? ??? ??? ??????
sp_getbindtoken , ???? ????? ?????? ????? ??? ???? ???:
[22018] [Microsoft] [ODBC SQL Server ???????] DIAG cast ????????? (0) ?? ??? ?????? ???? ???
SQLExecute SQL_SUCCESS_WITH_INFO ???? ??, ????? ??? ?????? ??????? ???? ???
??? ???? ?? ??? ???????
sp_getbindtoken ?????? ????????? ???????? ??, ?? ?????? ???????? ??? ???
Microsoft ?? ?????? ?? ?? SQL Server 6.5 ??? ??? ?????? ???
?? ?????? ?? SQL Server 7.0 ?? SQL Server 2000 ??????? ???? ???? ???
???? SQL Server 6.5, 5a ?????? ?????? ??? 1 ?? ??? ?? ??? ?? ?????? ?? ???? ??? ?? ?????? ??????? ???? ???? ?? ???????? ????????? ?? ??? ???? ??
isql ?? ?????? ???????? ???? ???
?? ??? ODBC ????????? ?? ???, ???????? ????????? ???????? ????? ????? ????? ??? ???? ??, ????? ?? ?? ?????? ?? ??????? ?? ???? ??? ???? ?????? ????????? ODBC API ???
SQLExecute SQL_SUCCESS_WITH_INFO ?? ??? ?????? ????? ???? ???
??????? ?? ???: ??????? ???? ?? ??? ??? ????? SQL ????????? ?? ????? ???? ??? Pubs ??????? ??? ??? ??????, ???? ???????? ????????? ?? ??? ?????? ?????:
create table emp_table (emp_id int primary key,
emp_name varchar(80) not null )
go
create trigger TR_emp_table_ins on emp_table
for insert as
begin
declare @token_value varchar(255)
exec master..sp_getbindtoken @token_value output
end
go
create procedure test_proc_one
@return_code int output,
@error_code int output
as
begin
declare @token_value varchar(255)
declare @max_emp_id int
select @return_code = 13
begin tran
select @max_emp_id = max(emp_id) from emp_table
if @max_emp_id is null
begin
select @max_emp_id = 1
end
else
begin
select @max_emp_id = @max_emp_id + 1
end
insert into emp_table values(@max_emp_id, 'John Doe')
if @@error <> 0
begin
raiserror('Insert into employee_list failed for emp_id %d', 16, -1, @max_emp_id)
rollback tran
select @return_code = -100
select @error_code = -200
end
else
begin
commit tran
select @return_code = 0
select @error_code = 2
end
end /* procedure test_proc_one */
go
???? ????? SQL ????????? ?????isql . ?? ??? ???? ????? ?? ??????? ??????, emp_table ??? ??? ?????? ???????? ????:
declare @ret_value int
declare @err_code int
declare @string varchar(255)
select @ret_value = 10
select @err_code = 20
exec test_proc_one @ret_value output, @err_code output
select @string = 'test_proc_one set ret_value to ' + rtrim(convert(varchar(16), @ret_value))
+ ' and err_code to ' + rtrim(convert(varchar(16), @err_code))
print @string
select * from emp_table
????? ????? ??? ?? ????? ?? ??? ODBC ????????? ?? ???? ???????? ????????? ?? ??? ????? ???? ?????? ???? ?? ???? ?? ???? reproduced ??? ???? ??? shown ?????? ?? ??? ?? ODBC ??????? ????? ?? ????? ?????
SQLRETURN rc;
SQLCHAR* SQLStr = "{call test_proc_one(?,?)}";
SQLINTEGER nReturnCode = SQL_NTS;
SQLINTEGER nErrorCode = SQL_NTS;
SQLINTEGER cbReturnCode = SQL_NTS;
SQLINTEGER cbErrorCode = SQL_NTS;
/* Prepare the statement, bind parameters, and execute the statement */
rc = SQLPrepare(hStmt, SQLStr, SQL_NTS);
rc = SQLBindParameter(hStmt, 1, SQL_PARAM_OUTPUT, SQL_C_LONG, SQL_INTEGER,
0, 0, &nReturnCode, 0, &cbReturnCode);
rc = SQLBindParameter(hStmt, 2, SQL_PARAM_OUTPUT, SQL_C_LONG, SQL_INTEGER,
0, 0, &nErrorCode, 0, &cbErrorCode);
rc = SQLExecute(hStmt);
do {
rc = SQLMoreResults(hStmt);
} while (rc != SQL_NO_DATA);
??? SQL ?????? 22018 ?? SQL_SUCCESS_WITH_INFO ?? ?? ?????? ??? ?? ??? "cast ???????? ?? ??? ?????? ???? ???" ????? ??? ??? ?????? ???? ????? ??? ?? ????? ODBC ????? ??? ??:
mssamp 163:166 EXIT SQLExecute with return code 1 (SQL_SUCCESS_WITH_INFO)
HSTMT 0x00cc2158
DIAG [22018] [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification (0)
???? ???? ???? ??: Microsoft SQL Server 6.5 Standard Edition Microsoft Data Access Components 2.1 Microsoft Data Access Components 2.5 kbbug kbdatabase kbpending kbmt KB269011 KbMthi
???? ?????? ???????? ??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:
269011
(http://support.microsoft.com/kb/269011/en-us/
)
Was this information helpful?
How much effort did you personally put forth to use this article?
Tell us why and what can we do to improve this information
Thank you! Your feedback is used to help us improve our support content. For more assistance options, please visit the
Help and Support Home Page .
???? ?????? ???? ?????? ??????
??????
??? ?????? ??????? ????
???? ??????