Why My Ado.net Queries Does Not Run In Single Execution But They Will Run In Seperate Executions?
Regarding a question and its related answer, I'm trying to create a new table type using SQL queries and run a join query on data which are of this table type. I put both queries
Solution 1:
The table type must exist before the parameterized query that uses the type is executed. The reason is the database engine first creates an internal table in tempdb matching the table type defined on the server before the batch executes. It then bulk inserts the TVP value into tempdb using the structured parameter value and meta-data provided by the API. Only after the table is loaded does the batch execute, where it can use the TVP value.
The implication is that one cannot create the table type and use it in the same batch that uses the type as a parameter.
Post a Comment for "Why My Ado.net Queries Does Not Run In Single Execution But They Will Run In Seperate Executions?"