on 10-28-2015 4:33 PM
Pessoal,
Estou tentanto criar uma transaction notification para travar caso o usuário não preencha um campo que foi criado.
Entretanto existe algum erro na sintaxe.
O Comando esta assim:
- ---Adiantamento a Clientes Pedido de Vendas---
If ((Select u_adiant_clientes From ORDR Where DocEntry = @list_of_cols_val_tab_del) = '' Or
(Select u_adiant_clientes From ORDR Where DocEntry = @list_of_cols_val_tab_del) is NULL(u_adiant_clientes),''))
Begin
Set @error = 1;
Set @error_message = 'Favor preencher se houve Adiantamento a Clientes!'
End
Poderiam me ajudar?
Olá Elder,
Tente desta forma:
IF @object_type='17' AND @transaction_type in ('A', 'U') BEGIN
IF ((SELECT u_adiant_clientes FROM ORDR WHERE DocEntry = @list_of_cols_val_tab_del) = '' Or
((Select u_adiant_clientes FROM ORDR WHERE DocEntry = @list_of_cols_val_tab_del) is NULL))
BEGIN
Set @error = 1;
Set @error_message = 'Favor preencher se houve Adiantamento a Clientes!'
END
END
Atenciosamente,
Diego
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Olá Helder,
Sua consulta esta quase perfeita faltou apenas 1% rsrsrsr, pois quando o campo que não pode está em branco é na linha do documento ele esta ocorrendo o seguinte erro:
[Microsoft][SQL Server Native Client 11.0][SQL Server]Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. (CINF).
Saberia explicar o porquê?
Att:
Jefferson Maldonado.
Helder consegui resolver, ficou assim
IF @object_type='17' AND @transaction_type in ('A', 'U') BEGIN
IF ((SELECT Top 1 U_Segmento FROM RDR1 WHERE DocEntry = @list_of_cols_val_tab_del) = '' Or
((Select Top 1 U_Segmento FROM RDR1 WHERE DocEntry = @list_of_cols_val_tab_del) is NULL))
BEGIN
Set @error = 1;
Set @error_message = 'Favor preencher o campo segmento na linha do produto/serviço!'
END
END
Abs
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
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.