Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1734

Re: How to remove the time part from a field in sql server database when I make a select

From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: How to remove the time part from a field in sql server database when I make a select
Date 2014-03-15 17:31 +0100
Organization Erland Sommarskog
Message-ID <XnsA2F1B253CFBF1Yazorman@127.0.0.1> (permalink)
References <lg1l34$knv$1@dont-email.me>

Show all headers | View raw


Tony Johansson (johansson.andersson@telia.com) writes:
> In this method GetBokningar I fetch all rows and return a DataSet but I
> hope I can remove the time part in some way. Now I get for example
> format 2013-03-12 00:00:00 for columns BokningFromDate and BokningToDate
> because these are DateTime column in the database. I could use  a
> DataReader and convert to string but I hope I can fix it within sql in
> some way. 

Presentation issues are best done in the UI, but you could use the data
type date throughout in the database. Or you could do

convert(date, BookingFromDate)


-- 
Erland Sommarskog, Stockholm, esquel@sommarskog.se

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Find similar


Thread

How to  remove the time part from a field in sql server database when I make a select "Tony Johansson" <johansson.andersson@telia.com> - 2014-03-15 14:37 +0100
  Re: How to  remove the time part from a field in sql server database when I make a select "Tony Johansson" <johansson.andersson@telia.com> - 2014-03-15 16:58 +0100
  Re: How to remove the time part from a field in sql server database when I make a select Erland Sommarskog <esquel@sommarskog.se> - 2014-03-15 17:31 +0100

csiph-web