I'm writing stored procedure to compare dates but it's not working properly. How can I make it so it compares only the dates but not the time? What I'm trying to do is compare the times and if the Id is null than insert a new entry with the same name but new time. I'm keeping multiple entries with same name but different test time.
ALTER PROCEDURE [dbo].[UL_TestData]
(
@Name varchar(30),
@Test_Time smalldatetime,
@ID INT output
)
AS
Declare @UpdateTime smalldatetime
SELECT @ID=ID FROM Info_User WHERE Name=@Name AND UpdateTime= @Test_Time
IF(@ID IS NULL)
BEGIN
INSERT INTO Info_User (Name, UpdateTime) VALUES (@Name, @UpdateTime)
END