--This is how it currently works...we want to check the *hour* DECLARE @CUTOFF DATETIME declare @poDate datetime SET @CUTOFF = dateadd(hour,16,CONVERT(VARCHAR,GETDATE(),101)) set @poDate ='2011-02-04 10:38:00.000' -- Then compare If @poDate <= @cutoff Begin ..... End ------ This is what i want to do ----------- -- But for cutoff date, I created a table with values like this, looking at the *hour* --1900-01-01 15:00:00.000 --1900-01-01 19:00:00.000 create table #cutoff ( id int identity, shipmethod varchar(20), cutoffHour datetime ) insert into #cutoff ('USPS','1900-01-01 16:00:00.000') insert into #cutoff ('UPSA','1900-01-01 19:00:00.000') /* But now, the date is "1900-01-01" and I cant just do a comparision. I think I need to somehow get the "date" part from getdate() and concat it to Time part and then do the comparision. */ select @cutoffhour = cutoffhour from #cutoff --somehow concat Date of getdate to time from cutoff hour If @poDate <= @cutoffHour Begin ..... End
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
12 Experts available now in Live!