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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 fuction call with select statement problem

Author  Topic 

rasimgs
Starting Member

2 Posts

Posted - 2008-11-08 : 07:01:50
Hi,

I want to call a function that requires 10 variables by using select statement

select dbo.B2X_FADRESDETAY (1,1,1,1,1,1,1,1,1,',') from B2X_TBLADRESDETAY is a correct calling statement


but I dot want to send null varibales to the function


for example;
select dbo.B2X_FADRESDETAY (1,',') from B2X_TBLADRESDETAY

but error message occurs

Msg 313, Level 16, State 2, Line 1
An 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 statement

is 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
Go to Top of Page

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?
Go to Top of Page

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.
Go to Top of Page

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
Go to Top of Page
   

- Advertisement -