Hi,
I have a UDF in SQL 2005 that throws the following error when invoked by a select query.
msg 512: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
I am passing parameters through a variable. However it runs fine when I pass the parameters by hard coding.
1- IT RUNS FINE as I am hard coding the parameters
select * from UDFxyz('08/01/2012','08/15/2012','ALL','New York,CANADA','ALL',Null,Null)
2- THROWS ERROR when parameters are passed as variables
Declare
@Date1 datetime,
@Date2 datetime,
@CnCode varchar(8000),
@Reg1 varchar(8000),
@Cen varchar(3)
Select
@Date1 = '08/01/2012',
@Date2 = '08/15/2012',
@CnCode = 'ALL',
@Reg1 ='New York,CANADA',
@Cen ='ALL'
select * from UDFxyz(@Date1,@Date2,@CnCode,@Reg1,@Cen,Null,Null)
Please help!!