Hi,
I've created an SQL stored procedure:
CREATE PROCEDURE usp_MyTableInsert
...
@name varchar(100),
@birthdate datetime = NULL,
@phoneno varchar(10),
...
And I call it from ColdFusion code:
<cfstoredproc
datasource="training"
procedure="usp_MyTableInsert">
....
<cfprocparam cfsqltype="CF_SQL_VARCHAR" value="#form.name#" dbvarname="@name">
<cfprocparam cfsqltype="CF_SQL_DATE" value="#ParseDateTime(form.birthdate)#" dbvarname="@birthdate">
<cfprocparam cfsqltype="CF_SQL_VARCHAR" value="#form.phoneno#" dbvarname="@phoneno">
....
</cfstoredproc>
What if I don't want to pass birthdate as a parameter? It should take NULL value, as I set it as default value in SP. If I remove it, It gives me an error like cannot convert varchar to datetime, that means we need to pass all parameter in correct order.
Thanks..