Quantcast
Channel: Funcio union ALL
Viewing all articles
Browse latest Browse all 4

Funcio union ALL

$
0
0

Hola.

Tienes algunos errores de sintaxis. Prueba así:

create FUNCTION [dbo].[cobranzaAnulados]

(

 @codigoVendedor as int
)

RETURNS int

AS

BEGIN
	--DECLARAMOS LAS VARIABLES QUE UTILIZAREMOS
	DECLARE @retorno as int,@Cons as int,@Rev as int,@Nic as int

select @Cons = count(co1) from cccont1 a, ccasig1 b where 
b.as1=a.co1 and b.as3=36 and (CO19='A')

select @Rev = count(re1) from CCCREV1 a, ccasig1 b where 
b.as1=a.re1 and b.as3=36 and (re13='A')

select @Nic = count(cn1) from CCCNIC1 a, ccasig1 b where 
b.as1=a.cn1 and b.as3=36 and (cn12='A')
	
select @retorno = @Cons + @Rev + @Nic
RETURN @retorno

end

 

Si tienes dudas, nos dices.


Alberto López Grande (Visita mi blog en http://qwalgrande.blogspot.es/)

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>