I'm new to Stored Procedures.
This is kind of what I want to do:
=======================================
DECLARE @iCount int
iCount = 0
SELECT DISTINCT Title FROM newMovies WHERE isNew = 1
?? assign the value of each Title to a variable (i.e. newTitle)
IF NOT EXISTS (SELECT tableID from MyCollection WHERE Title = newTitle)
?? then for each record returned, check to see if it exists in my collection
BEGIN
?? if the title doesn't exist, add it to the collection
INSERT INTO MyCollection (Title) VALUES (newTitle)
iCount = iCount + 1
END
UPDATE newMovies SET isNew = 0 WHERE isNew = 1
RETURN(iCount)
=======================================
Thanks for any help you can give this newbie.
.jkl.
This is kind of what I want to do:
=======================================
DECLARE @iCount int
iCount = 0
SELECT DISTINCT Title FROM newMovies WHERE isNew = 1
?? assign the value of each Title to a variable (i.e. newTitle)
IF NOT EXISTS (SELECT tableID from MyCollection WHERE Title = newTitle)
?? then for each record returned, check to see if it exists in my collection
BEGIN
?? if the title doesn't exist, add it to the collection
INSERT INTO MyCollection (Title) VALUES (newTitle)
iCount = iCount + 1
END
UPDATE newMovies SET isNew = 0 WHERE isNew = 1
RETURN(iCount)
=======================================
Thanks for any help you can give this newbie.
.jkl.