How to Trim data records on msdb using Sql?

itayzoro

Member
Joined
Jul 28, 2008
Messages
23
Programming Experience
Beginner
I got 1 Field that fill with "2008/02/04 15:46:00" What i need is to change all of the row to "15:46" Without the "2008/02/04"
simple trim but how i done it with sql statment? And How i do this to the all Row ??
VB.NET:
Dim dbFileNew As String = "C:\Dest.mdb"
        Dim con As New OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source =" & dbFileNew)
        Dim strsql3 As String
        strsql3 = "UPDATE [" & dbFileNew & "].Sniff_1fix Need the correct Statment"
        Dim cmd As New OleDbCommand(strsql3, con)
        con.Open()
        cmd.ExecuteNonQuery()
        con.Close()
 
Then, you cant..

Trying to remove the Date portion of a Date column is like trying to remove the 0 from 0.1234 - it cannot be done. If you really want to know why, read up on how dates are stored in a db (as a fractional number of days since some point in time)
 
In a datetime field, you can not exclude the date.

However when you query your info you can do it in a way that the results display just the time as you asked.

Select Convert(Char(108), YourDateField, 108) From YourTableName
 

Latest posts

Back
Top