Hi,
I try to execute stored procedure with output parameter.
var UniCommand : TUniSql;
begin
UniCommand.ParamCheck := True
UniCommand.SQL.Text := 'EXEC A_STOREDPROC_NAME 0,:IPAR OUTPUT';
for i := 0 to UniCommand.Params.Count-1 do
UniCommand.Params.ParamType := ptInputOutput; // Direction := pdOutput;
UniCommand.Prepare;
UniCommand.Execute;
end;
I get "Implicit conversion from data type sql_variant to int is not allowed. Use CONVERT function to run this query".
I did not get this error if I use AdoCommand.
How to solve this problem.
Thanks
Tugrul
Implicit conversion from data type sql_variant to int error
-
- Posts: 32
- Joined: Mon 25 Aug 2008 18:28
-
- Posts: 32
- Joined: Mon 25 Aug 2008 18:28
Hi,
Unidac 3.00.0.10 for Delphi 7
MsSQL 2005 Standart Edition
Sample stored procedure is.. ( you can adapt to your test environment )
CREATE PROCEDURE [dbo].[A_STOREDPROC_NAME](@ID INT,@NEWID INT OUTPUT) AS
begin
INSERT INTO ATABLE (AFIELD) VALUES (0)
SET @NEWID = SCOPE_IDENTITY()
end;
Regards
Tugrul
Unidac 3.00.0.10 for Delphi 7
MsSQL 2005 Standart Edition
Sample stored procedure is.. ( you can adapt to your test environment )
CREATE PROCEDURE [dbo].[A_STOREDPROC_NAME](@ID INT,@NEWID INT OUTPUT) AS
begin
INSERT INTO ATABLE (AFIELD) VALUES (0)
SET @NEWID = SCOPE_IDENTITY()
end;
Regards
Tugrul
-
- Posts: 32
- Joined: Mon 25 Aug 2008 18:28
More flexible solution
Thanks... The solution accepted.
Regards
Tugrul
Regards
Tugrul