This is your 5th question posted. At least put some effort in and learn to format your code so we can at least read it. I have done that for you.
If you want help, and for us to read your code, take pride in what you post, it will show. Click on the "Improve question" link and see how it is done. Here is your original posting: original posting
Have you used the debugger? Have you set break points in your code to see what the values are on the client? When the data hit the server? Do you know what values are being passed to the
before passing to the database?
That Stored Procedure is too big to debug if there was a problem. You need to break it into more than one Stored Procedure, each with a single responsibility. Less complexity = less issues.
Dumping your client, server, and SQL code here with little to no explicit explanation, nor any effort shown in debugging your own code, is only showing us that you want us to debug your code. We are not here to do your debugging for you. We do not need to see all of this code. Why do you expect us to want to help you if you can't help yourself?
Here are the steps that I would need to do if I was to debug your code...
Work backwards on your issue
I would set a debug breakpoint on this line in the
When the execution stops on this line of code, inspect the values and check if they are correct. If not, then keep working backwards, setting breakpoints, stepping through the code, and see where the values are either changed or not passed correctly. Then you will know where yourt issue is. Then you can start fixing your problem.
, go to the Sources
Time for you to roll up your sleeves and work out where the issue is.