[quoted text, click to view] segis bata wrote:
> Hello everyone,
>
> I'm writing you because I need help in something that's taking too
> long. I want to build a Stored Procedure to be accessed by an ASP
> page and I need that Stored Procedure to do a couple of things:
> 1.. Depending on parameters sent by the ASP page, do a SELECT
> statement to a table (tblX01) and if it returns ZERO records, the SP
> should insert some info into other table (tblX02) and if returns ONE
> record, it won't insert into tblX02
> 2.. Insert some other info in another table (tblX03)
> With #2 I don't have a problem, is with #1, how do I know the select
> statement returns ZERO or ONE record? how do I capture that value in
> the Stored Procedure?
>
IF EXISTS (SELECT * FROM tblX01 WHERE ...)
BEGIN
INSERT INTO tblX02 ...
END
HTH,
Bob Barrows
PS. Please don't crosspost to so many groups. sqlserver.programming was the
only really relevant group, although .asp.db would have been all right as
well, despite the fact that the question was answerable without even
mentioning asp.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.