on 10-06-2008 7:15 PM
Como puedo hacer una validacion donde no se puedan crear Articulos que siempre empiecen con la letra A y no con otra
Slds
Edited by: Rui Pereira on Nov 7, 2008 10:05 AM
Manuel:
gracias por el dato pero no me funciono pero me ayudo bastante para poder hallar la solucion aqui envio el query a fin que le pueda servir al foro
/***********************************MAESTRO DE ARTICULOS**************************************************/
DECLARE @CODLON NVARCHAR
DECLARE @CODART NVARCHAR
-- VALIDA QUE EL TIPO DE ARTICULO TENGA COMO CARACTER INICIA SOLO A=ARTICULOS, N=MUESTRAS DE STOCK, M=MUESTRAS ORIGINALES, S=SERVICIO
IF @object_type = '4' --MAESTRO ARTICULOS
BEGIN
IF @transaction_type = 'A' or @transaction_type = 'U'
BEGIN
SET @CODART=(SELECT LEFT(T0.ITEMCODE,1) FROM OITM T0 WHERE T0.itemcode=@list_of_cols_val_tab_del)
IF (LEFT(@CODART,1) NOT IN ('A','N','M','S'))
BEGIN
SELECT @error = 1
SELECT @error_message = 'NO SE PUEDE INGRESAR EL CODIGO CON ESE CARACTER VERIFIQUE EL TIPO DE ARTICULO A, N, M, S'
END
-- VALIDA QUE EL CODIGO SOLO SEA DE 7 CARACTERES
SET @CODLON=(SELECT T0.ITEMCODE FROM OITM T0 WHERE T0.itemcode=@list_of_cols_val_tab_del)
IF LEN(@CODLON) < 7
BEGIN
SELECT @error = 1
SELECT @error_message = 'EL CODIGO SOLO PUEDE SER IGUAL A 7 CARACTERES'
END
END
END
Edited by: Rui Pereira on Apr 15, 2009 10:31 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Por el store procedure, transaction notification.
set ANSI_NULLS ON
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'
--------------------------------------------------------------------------------------------------------------------------------
-- ADD YOUR CODE HERE
DECLARE @Num int
IF @object_type = '4' --MAESTRO ARTICULOS
BEGIN
IF @transaction_type = 'A' or @transaction_type = 'U'
BEGIN
SET @Num=(
SELECT COUNT(*)
FROM OITM T0
WHERE ((right(T0.ItmsGrpCod,1)<> 'A')
) and T0.itemcode=@list_of_cols_val_tab_del
)
IF (@Num>0)
BEGIN
SELECT @error = 101
SELECT @error_message = N'Ud. No Puede Crear Articulos con Este Codigo, Revise'
END
END
END
--------------------------------------------------------------------------------------------------------------------------------
-- Select the return values
select @error, @error_message
end
Att,
Manuel Lazcano
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
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.