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 2:16am
Edited 22-Jan-13 3: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 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | 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