Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > MS SQL Server
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 07-05-2010
Avatar de olbeup
olbeup olbeup is offline
Miembro
 
Registrado: jul 2005
Ubicación: Santiago de la Ribera (España)
Posts: 688
Poder: 22
olbeup Va camino a la fama
Quizás éste código te resulte más cómodo
Código SQL [-]
CREATE PROCEDURE dbo.insert_tab(@serie int, @numero int)
AS
BEGIN
  DECLARE
    @existe bit

  SET @existe = 
        (SELECT 
            COUNT(*) 
          FROM aa_prueba 
          WHERE SERIE = @serie 
                AND NUMERO = @numero)
  
  IF (@existe = 0)
  BEGIN
    BEGIN TRANSACTION
    INSERT INTO aa_prueba (SERIE, NUMERO) VALUES (@serie, @numero)    
    PRINT 'Good Insert....'
    COMMIT TRANSACTION
    RETURN 0
  END
  ELSE BEGIN
    RAISERROR('Bad insert....', 16, 1)
    RETURN -1
  END
END
Un saludo.
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Stored Procedure !!! Ledian_Fdez C++ Builder 0 02-03-2010 14:01:29
Stored Procedure StartKill MySQL 2 27-08-2008 06:18:44
Ayuda con Stored Procedure gluglu Conexión con bases de datos 6 26-09-2007 14:20:53
Ver los Stored Procedure tgsistemas SQL 0 06-04-2004 17:18:22
Stored Procedure tgsistemas SQL 1 27-02-2004 13:10:33


La franja horaria es GMT +2. Ahora son las 11:03:04.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi