Tag Info

New answers tagged

3

For now While stuck with your unfortunate solution: CHECK ((end_time AT TIME ZONE 'UTC' AT TIME ZONE 'US/Eastern')::time = '23:59:59'::time) That's right, AT TIME ZONE two times: The first instance transforms your timestamp without time zone into timestamp with time zone. that's assuming you are actually storing UTC times. The second instance converts ...


3

You may use to_char to get the time fields from a single function call: check (to_char(end_time at time zone 'UTC' at time zone 'US/Eastern','HH24:MI:SS') = '23:59:59') Seconds given by SS are not rounded up so that should be OK as an equivalent to floor


0

Try this. It maybe be faster, but still unreadable: alter table bananas add constraint ck_end_time_is_end_of_day check ( (end_time at time zone 'UTC' at time zone 'US/Eastern')::timestamp::date + interval '23:59:59' = date_trunc('second', end_time at time zone 'UTC' at time zone 'US/Eastern') ) ;


1

Will the ALTER TABLE command that changes only COLLATION of a column and nothing else increment values of a TIMESTAMP column on SQL Server 2008 R2 Std.? No it wont change/incement the values of timestamp column. altering a collation is specific to that column only. From BOL : The value in the timestamp column is updated every time a row containing ...


1

You cannot simply use the difference operator -, because it does not allow multiple resulting rows: ERROR: result of range difference would not be contiguous So you need to create three rows and use the intersection operator *: 1st range unbounded up to lower bound 2nd range as given 3rd range upper bound to unbounded WITH cte(r, val) AS (SELECT ...



Top 50 recent answers are included