This is SQL 2000....
I have a piece of SQL code and I do a comparision. See below.
That works but I created a table to hold "cut off" hours for shipments. Now, I dont know how to do the comparison..i somehow need to concat "date" of "getdate" to "time" from the table...then do the comparison..
see below please
--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
------ This is what i want to do -----------
-- But for cutoff date, I created a table with values like this, looking at the *hour*
create table #cutoff
id int identity,
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