on 11-06-2014 6:35 PM
Hola quisiera no repetir un reg. de cliente, pero quiero validar contra que campo hago la comparación del RFC o si tienen alguna otra pista saludos.
if @object_type = 2 and @transaction_type in ('A', 'U')
if exists (select T0.lictradnum from ocrd T0 where
T0.lictradnum = ' ? '
and T0.cardcode = @list_ of_ col_ val_ tab_ del
select @error = 6004, @error_message = 'Cliente ya Existe'
Gerardo, intenta así:
IF @object_type = '2' and @transaction_type in ('A','U')
BEGIN
declare @RFC varchar(13)
declare @tipoSN varchar(1)
declare @existe varchar(13)
declare @re varchar(10)
SELECT @tipoSN = CardType FROM OCRD T2 WHERE @list_of_cols_val_tab_del= T2.CardCode
select @re = CASE when @tipoSN = 'C' then 'Cliente' when @tipoSN = 'S' then 'Proveedor' else 'Lead' end
SELECT @RFC = LicTradNum FROM OCRD T3 WHERE @list_of_cols_val_tab_del= T3.CardCode and T3.CardType=@tipoSN
Select @existe = T4.LicTradNum from OCRD T4 where T4.LicTradNum=@RFC AND T4.CardCode <> @list_of_cols_val_tab_del
and T4.CardType=@tipoSN
if @existe is not null
begin
set @error = 1
set @error_message = 'RFC ' + @RFC + ' ya existente como ' + @re + '. Verificar información.'
end
END
Nos cuentas si te resultó.
Saludos,
JC.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.