🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #3145

Re: Consulta SQL

#3145
From: ELLOCONEWS
Date: Sun, 15 May 2005 14:37
46 lines
2209 bytes
primero indenta tu codigo, esta muy desordenado, no se ven los if anidados,
luego te daras cuenta que te falta algunos beging end.

"Herrynet" <claudio.torrealba@vtr.net> escribi� en el mensaje
news:d53v0l$gfu$1@news1.nivel5.cl...
> 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: <d67mqr$pfi$1@news1.nivel5.cl>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!gail.ripco.com!news.mbo.net!news.tdl.com!news.he.net!news.kjsl.com!news1.nivel5.cl!not-for-mail
References: <d53v0l$gfu$1@news1.nivel5.cl>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,423c9acb7a65ff17
X-Google-Attributes: gid1593cb,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!gail.ripco.com!news.mbo.net!news.tdl.com!news.he.net!news.kjsl.com!news1.nivel5.cl!not-for-mail
From: "ELLOCONEWS" <NEWS@vtr.net>
Newsgroups: chile.comp.programacion
Subject: Re: Consulta SQL
Date: Sun, 15 May 2005 10:37:38 -0400
Organization: Varios
Lines: 48
Message-ID: <d67mqr$pfi$1@news1.nivel5.cl>
References: <d53v0l$gfu$1@news1.nivel5.cl>
NNTP-Posting-Host: pc-95-92-83-200.cm.vtr.net
X-Trace: news1.nivel5.cl 1116167835 26098 200.83.92.95 (15 May 2005 14:37:15 GMT)
X-Complaints-To: news@news1.nivel5.cl
NNTP-Posting-Date: Sun, 15 May 2005 14:37:15 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441