on 09-12-2012 10:32 PM
Estimados
Por medio de TN deseo asegurarme que en el dato maestro del IC se coloque al menos un número de teléfono y una cuenta de correo electrónico lo cual no encuentro difícil, sin embargo, el detalle está en que también quiero asegurarme que la cantidad de números en el teléfono sean 8 y que no contengan guiones entre números.
En cuanto al correo electrónico asegurarme que guarde el formato correspondiente cuenta@dominio . com
Lo anterior para evitar que solo ingresen datos por llenar el campo y pasar la advertencia, agradezco la ayuda
Actualmente tengo esto:
Para el número de teléfono
If @object_type = '2' and @transaction_type In ('A', 'U')
begin
Declare @Tele1 nvarchar (8)
Set @Tele1 = (Select T0.Phone1 from OCRD T0 where T0.CardType In ('C', 'L') and T0.CardCode = @list_of_cols_val_tab_del)
if @Tele1 Is Null or @Tele1 = ('')
Begin
Set @error = 206
Set @error_message = 'Información de campo requerida: Teléfono 1'
end
end
Para la cuenta de correo:
If @object_type = '2' and @transaction_type In ('A', 'U')
Begin
Declare @Correo varchar
Set @Correo = (Select T0.E_mail From OCRD T0 Where T0.CardType In ('C', 'L') and T0.CardCode = @list_of_cols_val_tab_del )
If @Correo Is Null or @Correo = ('')
Begin
Set @error = 208
Set @error_message = 'Información de campo requerida: Correo Electrónico'
end
end
Buenas Marco
Prueba este TN
IF @object_type =2 AND @transaction_type IN ('A', 'U')
BEGIN
/**** Telefono ****/
IF EXISTS(SELECT T0.Phone1 FROM OCRD T0 WHERE T0.CardCode=@list_of_cols_val_tab_del AND (T0.Phone1 IS NULL OR T0.Phone1=''))
SET @error=101
IF (SELECT CHARINDEX('-',T0.Phone1,1) FROM OCRD T0 WHERE T0.CardCode=@list_of_cols_val_tab_del)>0
SET @error=102
IF (SELECT LEN(T0.Phone1) FROM OCRD T0 WHERE T0.CardCode=@list_of_cols_val_tab_del)<>8
SET @error=103
/**** E-mail ****/
IF EXISTS(SELECT T0.E_Mail FROM OCRD T0 WHERE T0.CardCode=@list_of_cols_val_tab_del AND (T0.E_Mail IS NULL OR T0.E_Mail=''))
SET @error=104
IF (SELECT CHARINDEX('@',T0.E_Mail,1) FROM OCRD T0 WHERE T0.CardCode=@list_of_cols_val_tab_del)<=0
SET @error=105
SET @error_message=
CASE @error
WHEN 101 THEN 'Telefono obligatorio'
WHEN 102 THEN 'Telefono sin guiones'
WHEN 103 THEN 'Telefono debe tener 8 numeros'
WHEN 104 THEN 'E-mail obligatorio'
WHEN 105 THEN 'Formato de e-mail invalido, el formato debe ser "cuenta@dominio.com"'
END
END
Saludos
Felipe
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.