Reputation: 81821
I want to define stored procedure parameters which do not allow null arguments.
alt text http://www.pixelshack.us/images/xg3mr2xw0q13z22nal.jpg
That @MailItemId int OUTPUT
will be not nullable because when I import the stored procedure into the LINQ to SQL designer it says @MailIetmid is ref int? mailItemId
.
alt text http://www.pixelshack.us/images/er80hukg27lreiy9b83y.jpg
Thanks.
Upvotes: 3
Views: 2544
Reputation: 33484
You could create a function instead that returns an INT.
On the other hand, it is possible from SQL point of view that a NULL can be returned from function. I don't know how code generator will generate function for that. If it still returns a nullable int, I don't think it could be possible.
Upvotes: 0
Reputation: 144202
If nothing else, you can just modify the auto-generated code (in designer.cs) to not accept a nullable integer. If the parameter ever does end up being null, it will probably cause a weird exception down in the LINQ to SQL code, but that's not a huge deal.
Upvotes: 2
Reputation: 136727
No, you can't do this. Types in SQL Server can always be NULL.
Upvotes: 1
Reputation: 41613
You can specify a default value instead:
@MailItemId int OUTPUT = 0
or something like that
Upvotes: -2