Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.sqlserver.programming > #31327

How to add a datetime column for a 24 hour period

Newsgroups microsoft.public.sqlserver.programming
Date 2017-10-23 11:42 -0700
Message-ID <d0c629ca-5826-4cd4-baba-9848a915df19@googlegroups.com> (permalink)
Subject How to add a datetime column for a 24 hour period
From Mike Arney <mikespcnet.net@gmail.com>

Show all headers | View raw


I have a MSSQL table with the following columns and data types:

Topic -- nvarchar
Payload -- numeric
Timestamp -- datetime
id -- int


Here is some example data:

Topic	                Payload	Timestamp	        id
STG/A/CycleStart	0	2017-10-23 15:37:56.697	1651
STG/A/CycleStart	0	2017-10-23 15:37:55.670	1650
STG/A/CycleStart	0	2017-10-23 15:37:55.193	1649
STG/A/CycleStart	0	2017-10-23 15:37:54.687	1648



The Timestamp column's default value is set to: (getutcdate())


I need to add the TIMESTAMP column for the last 24 hours where TOPIC = 'STG/A/CycleStart' and PAYLOAD = 1

I also need this time in seconds.

Any help would be greatly appreciated.

Thanks,
Mike

Back to microsoft.public.sqlserver.programming | Previous | NextNext in thread | Find similar


Thread

How to add a datetime column for a 24 hour period Mike Arney <mikespcnet.net@gmail.com> - 2017-10-23 11:42 -0700
  Re: How to add a datetime column for a 24 hour period Erland Sommarskog <esquel@sommarskog.se> - 2017-10-23 23:51 +0200
    Re: How to add a datetime column for a 24 hour period Mike Arney <mikespcnet.net@gmail.com> - 2017-10-24 05:10 -0700
      Re: How to add a datetime column for a 24 hour period Mike Arney <mikespcnet.net@gmail.com> - 2017-10-24 05:12 -0700
    Re: How to add a datetime column for a 24 hour period Mike Arney <mikespcnet.net@gmail.com> - 2017-10-24 05:38 -0700
      Re: How to add a datetime column for a 24 hour period Erland Sommarskog <esquel@sommarskog.se> - 2017-10-24 20:49 +0200
        Re: How to add a datetime column for a 24 hour period Mike Arney <mikespcnet.net@gmail.com> - 2017-10-25 04:57 -0700
          Re: How to add a datetime column for a 24 hour period Erland Sommarskog <esquel@sommarskog.se> - 2017-10-26 20:58 +0200
            Re: How to add a datetime column for a 24 hour period Mike Arney <mikespcnet.net@gmail.com> - 2017-11-02 09:54 -0700
              Re: How to add a datetime column for a 24 hour period mikespcnet.net@gmail.com - 2018-05-08 08:21 -0700
                Re: How to add a datetime column for a 24 hour period Mike Arney <mikespcnet.net@gmail.com> - 2018-05-08 08:35 -0700
                Re: How to add a datetime column for a 24 hour period Erland Sommarskog <esquel@sommarskog.se> - 2018-05-08 19:48 +0200
                Re: How to add a datetime column for a 24 hour period Mike Arney <mikespcnet.net@gmail.com> - 2018-05-09 06:31 -0700
                Re: How to add a datetime column for a 24 hour period Mike Arney <mikespcnet.net@gmail.com> - 2018-05-09 06:34 -0700
                Re: How to add a datetime column for a 24 hour period Erland Sommarskog <esquel@sommarskog.se> - 2018-05-09 23:08 +0200

csiph-web