Hi,
The generated query used to work out the return model of a stored proc in invalid if it contains a user defined type.
The tool generates the following query for a stored proc in my database:
```
SET FMTONLY OFF; SET FMTONLY ON;
EXEC [Products].[ShipGoodsOut] @carrier=null, @service=null, @trackingNumber=null, @goodsOutIds=null
SET FMTONLY OFF; SET FMTONLY OFF;
```
The last parameter is a user defined table type:
```
CREATE TYPE [dbo].[Ids] AS TABLE(
[Id] [int] NOT NULL
)
```
Running the generated query gives the following error:
> Msg 206, Level 16, State 2, Procedure ShipGoodsOut, Line 13
Operand type clash: NULL is incompatible with Ids
That causes an exception and means the code required to populate the return model is never generated and so it fallsback to the code required to set the out parameter.
If I change the query such that it looks like this:
```
SET FMTONLY OFF; SET FMTONLY ON;
DECLARE @carrier varchar(25)
DECLARE @service varchar(25)
DECLARE @trackingNumber varchar(25)
DECLARE @goodsOutIds [dbo].[Ids]
EXEC [Products].[ShipGoodsOut] @carrier, @service, @trackingNumber, @goodsOutIds
SET FMTONLY OFF; SET FMTONLY OFF;
```
It works fine.
Comments: I give up! Why is it so hard to push a change?
The generated query used to work out the return model of a stored proc in invalid if it contains a user defined type.
The tool generates the following query for a stored proc in my database:
```
SET FMTONLY OFF; SET FMTONLY ON;
EXEC [Products].[ShipGoodsOut] @carrier=null, @service=null, @trackingNumber=null, @goodsOutIds=null
SET FMTONLY OFF; SET FMTONLY OFF;
```
The last parameter is a user defined table type:
```
CREATE TYPE [dbo].[Ids] AS TABLE(
[Id] [int] NOT NULL
)
```
Running the generated query gives the following error:
> Msg 206, Level 16, State 2, Procedure ShipGoodsOut, Line 13
Operand type clash: NULL is incompatible with Ids
That causes an exception and means the code required to populate the return model is never generated and so it fallsback to the code required to set the out parameter.
If I change the query such that it looks like this:
```
SET FMTONLY OFF; SET FMTONLY ON;
DECLARE @carrier varchar(25)
DECLARE @service varchar(25)
DECLARE @trackingNumber varchar(25)
DECLARE @goodsOutIds [dbo].[Ids]
EXEC [Products].[ShipGoodsOut] @carrier, @service, @trackingNumber, @goodsOutIds
SET FMTONLY OFF; SET FMTONLY OFF;
```
It works fine.
Comments: I give up! Why is it so hard to push a change?