I am currently experiencing the same issue as in thread http://www.llblgen.com/tinyforum/NewThread.aspx?ForumID=10 using v2.6 with the standard set of templates against SQL Server.
The exact problem is this:
I have a stored proc with the following parameters:
CREATE PROCEDURE [dbo].[Search]
(
@SearchType BIT,
@Name VARCHAR(100) = null,
@SecForename VARCHAR(100) = null,
@SecSurname VARCHAR(100) = null,
@CountyID INT,
@UniqueID INT,
@SecID INT,
@AffiliationNum VARCHAR(100) = NULL,
@ViewingCountyID INT,
@ShowAffiliatedOnly BIT = 0
)
Where @CountyID can be null but has no default value.
If I mark the parameter as nullable and pass null into the auto generated method the following SQL is executed:
exec [Onside].[dbo].[usp_Search] @SearchType=0,@Name='kent',@SecForename=default,@SecSurname=default,@CountyID= default,@UniqueID=default,@SecID=default,@AffiliationNum=default,@ViewingCountyID=1234,@ShowAffiliatedOnly=1
go
Predictably this throws the exception “Procedure or function 'usp_Search' expects parameter '@CountyID', which was not supplied.” as “@CountyID= default“ is requesting the default value is used which has not been specified. What I need to happen is for “@CountyID=default” to be changed to “@CountyID=null”.
Unfortunately I am not able to update the procs as they are out of my control.
Any help would be gratefully received.
Thanks.