Is it possible to pass a variable to a stored procedure? I am pulling the deliveryid and setting it as a variable but when I execute the stored procedure, I am getting an error:
ODB-240000 ODBC error: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Error converting data type nvarchar to bigint. SQLState: 37000
DeliveryId data type is an integer but I am not sure if the SQL is taking the variable literally.
Here is my logic:
EXEC [CDL].[dbo].[test] @deliveryid = [vars.deliveryId]
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @kl28morr,
The above error is showing you that deliveryid is being treated as a nvarchar instead of an integer (bigint).
You will need to try to convert the variable befor passing it to a stored procedure. I would be somehitng like this:
EXEC [CDL].[dbo].[test] @deliveryid = CONVERT(BIGINT, [vars.deliveryId])
Alternatively, if it this does not work you can try CAST function.
Finally, I leave you with useful documentation:
CAST AND CONVERT (TRANSACT -Sql)
Hope it helps, if you need more guidance please let me know.
Regards,
Celia
Hi @kl28morr,
The above error is showing you that deliveryid is being treated as a nvarchar instead of an integer (bigint).
You will need to try to convert the variable befor passing it to a stored procedure. I would be somehitng like this:
EXEC [CDL].[dbo].[test] @deliveryid = CONVERT(BIGINT, [vars.deliveryId])
Alternatively, if it this does not work you can try CAST function.
Finally, I leave you with useful documentation:
CAST AND CONVERT (TRANSACT -Sql)
Hope it helps, if you need more guidance please let me know.
Regards,
Celia
Views
Likes
Replies