Wednesday, March 21, 2012

date or time cutoff ?

is there a way to cut off the date or time in ms sql.........colum 1 date , colum 2 time...........at the moment it inputs the defaut values for date or time ......is there a way to leave it out so it shows only date or time,,,,,,,,,,,

i am trying this..............
update cir_temp_user_info
set date1 = convert(datetime, convert(char(10), getDate(), 101))

update cir_temp_user_info
set time1 = convert(datetime, convert(char(10), getDate(), 108))
which is not what i want ........the above is converting the whole colum..........is there a way to use the convert during an insert cmd.??..............i am still trying to trim the date and time colum.......can anybody help

|||1) update cir_temp_user_info
set date1 = convert(datetime, convert(char(10), getDate(), 101))

2) update cir_temp_user_info
set time1 = convert(datetime, convert(char(10), getDate(), 108))
--------
number 1 is kinda working ......it has trim the time off , but its not displaying the correct format for the date.....i want 12/05/2005 but its displaying 12/5/2005 is there a way to change this.............
number 2 is not working at all........i want only the time (hh:mm) but its displaying the default date and secs....is there a way to correct this ...........anyone ??

|||Is there any reason why you want to separate the Date and Time parts?Normally, the datetime is split into date and time part in the frontend which is a GUI issue. When it comes to storing it in the db, itsusually datetime type.

No comments:

Post a Comment