Hi, I am new to the stored proceedures and what I would like to do is send a data set to a stored proceedure. I don't know if this is possible. I though maybe you could do this if the stored proceedures had arrays. But I have looked in the books and found nothing on arrays. Below is an example of what I am doing with a single insert but my goal is to pass the proceedure the full data set without calling this multiple times like over 100,000 times.
CREATE PROCEDURE insertORupdate
@firstname char(10),
@lastname char(10),
@age char(10)
AS
Declare @lastnameresult char(10)
SELECT @lastnameresult=LastName from person where LastName = @lastname
if @lastnameresult = @lastname
BEGIN
print "Update Query"
UPDATE PERSON SET firstName = @firstname, age=@age where LastName = @lastname
END
ELSE
BEGIN
print "Insert Query"
INSERT INTO person values (@firstname, @lastname, @age)
END
Thanks for any help you can give me.
Randy
CREATE PROCEDURE insertORupdate
@firstname char(10),
@lastname char(10),
@age char(10)
AS
Declare @lastnameresult char(10)
SELECT @lastnameresult=LastName from person where LastName = @lastname
if @lastnameresult = @lastname
BEGIN
print "Update Query"
UPDATE PERSON SET firstName = @firstname, age=@age where LastName = @lastname
END
ELSE
BEGIN
print "Insert Query"
INSERT INTO person values (@firstname, @lastname, @age)
END
Thanks for any help you can give me.
Randy
