Click here to Skip to main content
12,360,037 members (58,368 online)
Rate this:
 
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
Updated 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160621.1 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2016
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