How to capture the SQL statement after parameter substitution?

J

John Dalberg

I am getting a "String or binary data would be truncated. The statement has
been terminated" error. I am trying to capture the exact SQL statement
that's causing the error but SQL Server's profiler doesn't have it and if I
capture the commandtext property of SQLCommand, the sql has the parameters
without substitution.

How do I capture the exact SQL after parameters substitution? It seems one
of the parameter values is too long to fit.
 
W

William \(Bill\) Vaughn

If the Profiler did not "get it" then this is a client-side problem with
ADO.NET. Nope, I don't know of a way to "see" the compiled SQL post
parameter insertion (other than what the Profiler shows). Since you're using
a Command with Parameters you'll need to trace through the Value set
statements to see which has a value outside of the desired range.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top