Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL
Hi,
 
I have a table
 
 VRS_DEVICEID          VRS_UTCTIME                    VRS_SPEED    VRS_LOCATION
 -------------          -----------                    ---------    -------------
 
  ST0001                2012-07-02 10:59:26.000        0.36         attigal
  ST0001                2012-07-02 11:33:36.000        40           tvm
  ST0001                2012-09-06 18:45:29.000        0.26         malappuram
  ST0001                2012-09-06 19:46:28.000        0.36         kozhikode
  ST0001                2012-10-09 12:10:12.000        50           idukki
  ST0001                2012-10-09 01:12:12.000        40           vayanadu

 
from this table how to retrieve a data as show below ,
 

VRS_DEVICEID          VRS_UTCTIME                    VRS_SPEED    VRS_LOCATION
 -------------          -----------                    ---------    -------------
 
  ST0001                2012-07-02                     0.36         attigal
  ST0001                2012-07-02                     40           tvm
  ST0001                2012-09-06                     0.26         malappuram
  ST0001                2012-09-06                     0.36         kozhikode
  ST0001                2012-10-09                     50           idukki
  ST0001                2012-10-09                     40           vayanadu

 
That is, remove the time part of column VRS_UTCTIME?
 
PLZ HELP....
 

THANKS..
Posted 18-Nov-12 18:53pm
hasbina1.3K
Edited 18-Nov-12 18:59pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

This is what I usually do:
 
SELECT VRS_DEVICEID, CONVERT(VARCHAR(10), VRS_UTCTIME, 121) AS VRS_UTCDATE, VRS_SPEED, VRS_LOCATION
FROM Table1
  Permalink  
Comments
hasbina at 19-Nov-12 0:07am
   
hI Andrew Cherednik2,
 
YA...got it..Thank you sooooo much...
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

use select (col1,col2,col3,....) from VRS_DEVICEID VRS_UTCTIME VRS_SPEED VRS_LOCATION
 
here remove datetime column from select statement.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 525
1 OriginalGriff 480
2 Sascha Lefévre 289
3 Richard Deeming 195
4 Peter Leow 148
0 Sergey Alexandrovich Kryukov 9,693
1 OriginalGriff 9,185
2 Peter Leow 5,112
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,876


Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100