another sql question
From: Pascal Schmidt-Volkmar (nospam_at_schmidt-volkmar.com)
Date: 01/21/04
- Next message: David Smith: "Re: Performance between TADODataset & TADOQuery"
- Previous message: Pascal Schmidt-Volkmar: "Re: inserting values from same table"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 21 Jan 2004 17:27:05 +0100
Hi there,
I need to find out in a stored procedure whether a dataset of a specific
number already exists. If not, the dataset should be insert else, nothing
should be done:
IF @NUMMER <> 0 SET @MAXNR = (SELECT MAX(AUS_NR)+1 FROM T_AUS WHERE
AUS_TYP_ID = @UMFRAGETYP_ID)
ELSE IF @NUMMER=0 SET @MAXNR=0
IF @MAXNR IS NULL SET @MAXNR = 1
IF NOT EXISTS (SELECT * FROM T_AUS WHERE AUS_TYP_ID=@UMFRAGETYP_ID AND
AUS_NR=0)
INSERT INTO T_AUS (AUS_TYP_ID, AUS_ANTWORT, AUS_NR)
VALUES (@UMFRAGETYP_ID, @ANTWORT, @MAXNR)
In my case, the dataset is never inserted...
Thanks,
Pascal
- Next message: David Smith: "Re: Performance between TADODataset & TADOQuery"
- Previous message: Pascal Schmidt-Volkmar: "Re: inserting values from same table"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]