Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date format

Status
Not open for further replies.

catalystcommercial

Technical User
Oct 6, 2005
53
GB
Hi there

Can anyone tellme the code to bring back all the data > than May 2005 in the following format DD/MM/YYYY and I also need to remove the time stamp

Thanks

Tim
 
Code:
SELECT *, convert(varchar(10),DateField, 103) AS MyDateFieldAsVarcharWithOutTimePortion from MyTable
       WHERE DateField > '20050531'

Borislav Borissov
 
Just thought about that and have problesm with INet :)

Borislav Borissov
 
Just thought about that and have problems with INet :)

Borislav Borissov
 
Hi guys

Thanks for your reply, not quite sure it is what I want

I want to change the date format and remove the time stamp...

This is my query:

select key1,company,ZIP,uenappsp,uenappby,UENTOP5,UENBOT55,UENSUP5,UENORDEV5,UENEXPPAY5,UENPAYREC5,UENCONST5,uenconsign,uenamrec5
from contact1 left outer join contact2
on contact1.accountno=contact2.accountno
where uentoP5 is not null
and UENCONST5 is not null
and UENEXPPAY5 > 'May1,05'
and UENCONST5 != 'OBJ'
and UENCONST5 != 'REJ'
and UENCONST5 != 'CAN'
and UENCONST5 != 'CON'
 
In the SELECT line, you need to make this change:
Code:
change this: UENEXPPAY5
to this:
CONVERT(VARCHAR(10), UENEXPPAYS, 101)
[code]

Refer to the BOL, use the index tab and enter CONVERT.

-SQLBill

Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top