kevinmackevin
asked on
How can i insert only disticnct values??
i am using a xml parser which runs every 20 mins and automatically inserts the data into the database.
It inserts the Stock's symbol, name, price and time (stock market time)
The problem is the parser runs all weekend long and just keeps putting in the same info, as the market is closed, at 4:00pm.
How can make it so it will only insert it in if the time stamp is unique
Thanks in advance
It inserts the Stock's symbol, name, price and time (stock market time)
The problem is the parser runs all weekend long and just keeps putting in the same info, as the market is closed, at 4:00pm.
How can make it so it will only insert it in if the time stamp is unique
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
declare @theUniqueThing int
select @theUniqueThing = 0
select @theUniqueThing =1
from dbo.your_table yt
where yt.stock_nm = @stock_nm
and yt.time = @time
and yt.price = @price
if (@theUniqueThing = 1)
BEGIN
INSERT INTO dbo.your_table
(a,b,c)
VALUES
(1,2,3)
END
Hope this makes sense.