on 10-28-2015 4:42 PM
Pessoal, boa tarde.
Estou tentando criar uma trava no pedido de vendas para não deixar gravar sem o usuário preencher um campo, este campo foi criado.
Trata-se do campo "u_adiant_clientes"
Entretanto acho que a sintaxe esta incorreta. Poderiam me ajudar por favor?
O comando que estou tentando é:
USE [zSBO_GLOBE_TESTE_27102015]
GO
/****** Object: StoredProcedure [dbo].[SBO_SP_TransactionNotification] Script Date: 28/10/2015 11:35:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[SBO_SP_TransactionNotification]
@object_type nvarchar(20), -- SBO Object Type
@transaction_type nchar(1), -- [A]dd, [U]pdate, [D]elete, [C]ancel, C[L]ose
@num_of_cols_in_key int,
@list_of_key_cols_tab_del nvarchar(255),
@list_of_cols_val_tab_del nvarchar(255)
AS
begin
-- Return values
declare @error int -- Result (0 for no error)
declare @error_message nvarchar (200) -- Error string to be displayed
select @error = 0
select @error_message = N'Ok'
--------------------------------------------------------------------------------------------------------------------------------
-- ---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
--------------------------------------------------------------------------------------------------------------------------------
-- Select the return values
select @error, @error_message
end
Boa tarde Elder.
Também funciona perfeitamente desta forma aqui :
If ISNULL(Select u_adiant_clientes From ORDR Where DocEntry = @list_of_cols_val_tab_del,'') = ''
Begin
Set @error = 1;
Set @error_message = 'Favor preencher se houve Adiantamento a Clientes!'
End
Abraços.
Augustus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bom dia Elder,
Tente fazer da seguinte forma:
Copie a sintaxe abaixo em sua transaction notification.
IF (@object_type in ('17') and @transaction_type in ('A'))
BEGIN
If Exists (Select T0.DocEntry from ORDR T0 where T0.DocEntry = @list_of_cols_val_tab_del AND ISNULL(T0.u_adiant_clientes,0)=0 )
Select @error = -1, @error_message = '(TransactionSQL) ERRO: Campo "XXX" não preenchido'
END
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
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.