Hi GUYS HOWS LIFE GOING..PAT, BRETT, how are you two doing???
I have a question and btw the other issues have been either resolved or no longer necessary.
Anyways I have this Stored Procedure that will insert updates into a form for me but the problem is if the records (example records between the date of 1/1/05 and 12/31/05) but the problem is if the 05 are already in there and I find that there's more 05's I get an primary key message, and I need to have it skip over those 05 that are already in the database adn insert the ones that are not already in there
Code:
ALTER PROCEDURE Corvan_05Insert
@pdBegin DATETIME = NULL
, @pdEnd DATETIME= NULL
AS
IF @pdBegin NOT BETWEEN '2005-01-01' AND '2005-12-31' -- "bad" begin date
SET @pdBegin = DateAdd(year, -2, GetDate()) -- Back up two years
IF @pdEnd IS NULL -- If no end date
SET @pdEnd = DateAdd(year, 1, @pdBegin) -- One year after the begin date
INSERT INTO [GamingCommissiondb].[dbo].[Corovan_Table](
[TM #], [FirstName], [LastName]
,[SS #], [TerminationDate], [Voluntary or Involuntary]
)SELECT
[TM #],[FirstName],[LastName]
,[SocialSecurityNumber], [TerminationDate], [VoluntaryorInvoluntary]
FROM TERMINATION
WHERE TerminationDate BETWEEN @pdBegin AND @pdEnd
RETURN