SQL Server Debugging: Break in Error?

I can’t find any debugging options when debugging SP in SSMS on SQL 2008. Is it possible that it was interrupted at the time the error occurred, so I can check exactly where the error is being generated, and what are the values ​​of the variables at this point?

The error I'm trying to debug is:

Msg 8152, Level 16, State 14, Procedure xxx, Line 58 String or binary data will be truncated.

+4
source share
2 answers

If you set an early point at an early stage, you can go through until you find an error.

As heads-up, however, you need to look for a case where you put a string in varchar that is longer than varchar allows.

So, if you have varcahr (5) and you are trying to set it as "mylongtext", you will get this error.


To do this in SSMS, right-click on SP and select EXECUTE TO> New Window. This will create the execution code for you:

DECLARE @RC int DECLARE @LocationID int DECLARE @SiteID int -- TODO: Set parameter values here. EXECUTE @RC = [MY-DB].[dbo].[P_SELECT_RetrieveToolTips] @LocationID ,@SiteID GO 

Move the cursor to the EXECUTE statement and press F9 to add a breakpoint.

Then click play (debug). When he stops at the breakpoint, press F11 to go to SProc and then F10 to go along each line.

+2
source

You can use the Sql Query Analyzer for this. Your message means that you are trying to store some value in a field whose length is less than the length of this value.

+2
source

Source: https://habr.com/ru/post/1340639/


All Articles