Re: Time Question

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Aaron Bertrand - MVP (aaron_at_TRASHaspfaq.com)
Date: 02/13/04


Date: Fri, 13 Feb 2004 14:11:35 -0500

PS you might consider adding a computed column, or creating a view, so you
can query directly against the 10-minute-offset value instead of constantly
performing date math.

One way to do it would be to add a column AS DATEADD(MINUTE, -10,
RecordTime)

Another way to do it would be to have the procedure that enters the row
calculate which "hour" the data belongs to, and store that in a tinyint.

-- 
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


Relevant Pages

  • Re: Question on Formula
    ... > You have to drop and recreate the computed column to change the formula: ... > CREATE TABLE a (b INT, ... > ALTER TABLE a DROP COLUMN c ... > SQL Server MVP ...
    (microsoft.public.sqlserver.msde)
  • Re: Alter char column to computed column
    ... "David Portas" wrote: ... > index (the usual reason for creating a computed column). ... > SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: Question on Formula
    ... You have to drop and recreate the computed column to change the formula: ... CREATE TABLE a (b INT, ... ALTER TABLE a DROP COLUMN c ... SQL Server MVP ...
    (microsoft.public.sqlserver.msde)
  • Re: Computed column vs Formula in SQL Query
    ... Unless you said PERSTISTED or created an index on the computed column, then the performance should be the same. ... Tibor Karaszi, SQL Server MVP ... Create a computed column in a table (tblA) with a formula ... Alter table tblA add colx as Left ...
    (microsoft.public.sqlserver.programming)