Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi,I want to call a function that requires 10 variables by using select statementselect dbo.B2X_FADRESDETAY (1,1,1,1,1,1,1,1,1,',') from B2X_TBLADRESDETAY is a correct calling statementbut I dot want to send null varibales to the function for example;select dbo.B2X_FADRESDETAY (1,',') from B2X_TBLADRESDETAYbut error message occurs Msg 313, Level 16, State 2, Line 1An insufficient number of arguments were supplied for the procedure or function dbo.B2X_FADRESDETAY.I initialize all the variables to null in the function.I call my function by using exec comment but I want to call it by select statementis it possible to do?
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2008-11-08 : 07:06:59
you need pass explicitly null for all the other columns
rasimgs
Starting Member
2 Posts
Posted - 2008-11-08 : 07:15:27
can you please give more detail?I have 27 columns in that table and in fuction I use 9 of them, is this the reason for that error?
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2008-11-08 : 11:37:34
nope. the reason is you've other parameters of function which you need to pass value for.even if you want it to take default value pass the explicitly the value as null.
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2008-11-08 : 11:42:44
as an example
select dbo.B2X_FADRESDETAY (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,',') from B2X_TBLADRESDETAY
instead of
select dbo.B2X_FADRESDETAY (1,',') from B2X_TBLADRESDETAY