I'm looking at query plan in SQL Server Mgmt Studio and I see something like this:
(@P0 nvarchar(4000), @P1 nvarchar(4000)) Update...
What does the type mean beside the parameters? For this example lets assume that the column for those parameters are actually
varchar(64). Is this how the parameters are being bound at runtime?
This is a Java EE application using JDBC 3.0 or 4.0 providers. Basically we have a properties file full of SQL statements like this:
mySqlStatementFoo = UPDATE Schema.Table.Column set column = 1 WHERE objectID = ?
It looks like in the past if there was a binding mismatch we would cast the param like so:
Where objectID = CAST(? AS VARCHAR(36))
I suppose they chose to do it this way since we support multiple databases. I.E. DB2 and Oracle. I haven't seen the actual Java, but I suspect they are just selecting the statement from the file and sending it down the wire. I'm doing load testing and seeing that we are doing table scans and suspect that the optimizer isn't using the correct index because the parameters are being bound incorrectly.