Hi @ΜΑΡΙΑ ΝΙΚΟΛΟΠΟΥΛΟΥ ,
Welcome to Microsoft Q&A!
We recommend that you post your procedure, XML Schema and error details if possible, enough to illustrate all angles of the problem. We also need to see the expected result.
but I want to store the error into a string variable and I need full error.
You could refer below:
DECLARE @err_msg AS NVARCHAR(MAX);
SET @err_msg = ERROR_MESSAGE();
select @err_msg
Or using BEGIN TRY/CATCH and RAISERROR as below:
DECLARE
@ErrorMessage nvarchar(max)
,@ErrorSeverity tinyint
,@ErrorState tinyint
BEGIN TRY
--type your code here
END TRY
BEGIN CATCH
SET @ErrorMessage = ERROR_MESSAGE()
SET @ErrorSeverity = ERROR_SEVERITY()
SET @ErrorState = ERROR_STATE()
RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState)
BREAK
END CATCH
Best regards
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.