🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #3104

Consulta SQL

#3104
From: Herrynet
Date: Mon, 02 May 2005 01:16
38 lines
1861 bytes
Hola a todos
Mi consulta va para las personas que se manejan en programacion de base de 
datos especificamente en SQL server. Ya que necesito saber como se manejan 
errores en en esta herramienta. Me refiero a algo como lo siguiente, pero 
solo que el error no me lo esta considerando o sea el raiserror nīŋŊ 'error q 
quiero'
ej:

create procedure insertar_ot_tarea (@idot varchar(10), @idtar varchar(10))
as

 if (@idot in (select id_ot from ot_tarea))
 if(@idtar in (select id_tarea from ot_tarea))
 begin
 print 'ya se encuentra el dato'
 end

 else if (@idot not in (select id_ot from ot_tarea) )
     begin
 if (@idtar not in (select id_tarea from ot_tarea))
   begin
   insert into ot_tarea
   values (@idot,@idtar)
   end

 end

else
  begin
  raiserror 30003 'La clave Primaria Insertada no esta en la tabla Padre'
--Esto no me lo pesca al tener mas de un if. PORQUE?
  end

de antemano se agradece cualquier tipo de ayuda.

Atte

Herrynet 
Technical Details
Message-ID: <d53v0l$gfu$1@news1.nivel5.cl>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!nntp-server.pubsub.com!news1.nivel5.cl!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,423c9acb7a65ff17,start
X-Google-Attributes: gid1593cb,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!nntp-server.pubsub.com!news1.nivel5.cl!not-for-mail
From: "Herrynet" <claudio.torrealba@vtr.net>
Newsgroups: chile.comp.programacion
Subject: Consulta SQL
Date: Sun, 1 May 2005 21:16:11 -0400
Organization: Varios
Lines: 40
Message-ID: <d53v0l$gfu$1@news1.nivel5.cl>
NNTP-Posting-Host: pc-65-27-104-200.cm.vtr.net
X-Trace: news1.nivel5.cl 1114996567 16894 200.104.27.65 (2 May 2005 01:16:07 GMT)
X-Complaints-To: news@news1.nivel5.cl
NNTP-Posting-Date: Mon, 2 May 2005 01:16:07 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original