Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server
Hello Friends
 
with the help of inner join,i joined two table like that
select SR.amountpaid,SR.date,S.name from SupplierRecord as SR inner join Supplier as S on SR.Supplierid=S.Supplierid where Purchaseid ='0'
in this joining i get a date with time like below
 
amountpaid date name
1000 2013-01-21 12:30:18.000 Vishal
2000 2013-01-22 10:29:41.000 A Mandlekar
 
but i want a only date (ie.2013-01-21 ) will be come not datewithtime (2013-01-21 12:30:18.000).
 
so can you please help me.
 
thnx in advance.
Posted 22-Jan-13 1:16am
Edited 22-Jan-13 2:35am
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You need to use the CONVERT function with format 23: http://www.sqlusa.com/bestpractices2005/centurydateformat/[^]
 
select 
  SR.amountpaid,
  convert(varchar, SR.date, 23),
  S.name 
from SupplierRecord as SR 
inner join Supplier as S on SR.Supplierid=S.Supplierid 
where Purchaseid ='0'
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 483
1 Sergey Alexandrovich Kryukov 207
2 RyanDev 165
3 PhilLenoir 135
4 Richard Deeming 120
0 Sergey Alexandrovich Kryukov 6,415
1 OriginalGriff 5,856
2 CPallini 2,473
3 Richard MacCutchan 1,667
4 Abhinav S 1,530


Advertise | Privacy | Mobile
Web03 | 2.8.140821.2 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2014
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