I am trying to get all characters before a space:
SUBSTRING(reporttime,1,CHARINDEX(reporttime,' ',1))
but it does not work. please, help!
data examples:
7/8/2010 11:47 AM 7/8/2010 10:55 AM
Select Substring( MyTextColumn, 1, CharIndex( ' ', MyTextColumn ) - 1)
Actually, if these are datetime values, then there is a better way:
Select Cast(DateDiff(d, 0, MyDateColumn) As datetime)
To get a date from a DateTime value, the best line of code I found is to remove the time value and change your requirements:
CONVERT(NVARCHAR(10), reporttime, 103)
It will be displayed on 08/07/2010.
Source: https://habr.com/ru/post/1760641/More articles:WF4 service client does not create proxy class - wcfVBA script, ΡΡΠΎΠ±Ρ Π·Π°ΠΊΡΡΡΡ ΠΊΠ°ΠΆΠ΄ΡΠΉ ΡΠΊΠ·Π΅ΠΌΠΏΠ»ΡΡ Excel, ΠΊΡΠΎΠΌΠ΅ ΡΠ°ΠΌΠΎΠ³ΠΎ ΡΠ΅Π±Ρ - vbaUsing the correct jQuery submitHandler validation module - javascriptΠ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠΈ Silverlight 4 (OOB) Π²Ρ ΠΌΠΎΠΆΠ΅ΡΠ΅ ΠΏΠ΅ΡΠ΅ΠΌΠ΅ΡΡΠΈΡΡ Π³Π»Π°Π²Π½ΠΎΠ΅ ΠΎΠΊΠ½ΠΎ Π² ΠΊΠΎΠ΄Π΅ - silverlight-4.0Is it possible to predict whether a mathematical operation will lead to overflow? - mathDjango socialauth: ΠΊΠ°ΠΊΠ°Ρ Π»ΡΡΡΠ°Ρ Π²ΠΈΠ»ΠΊΠ°? - djangoThe struggle to overload the operator "==" to work (C ++) - c ++Include javascript public folder in RAILS Views - ruby-on-railsWhy is the build: None action ignored for the * .cs file? - c #How to avoid duplicate entries? - iosAll Articles