SQL Server : split string in SELECT statement -
I want to split date in column 3 areas, I use this query
SELECT SUBSTRING (Account.date, 1, 2) "Month" as, SUBSTRING (Account.date, 4, 2) as "day", SUBSTRING (Account.date, 7, 4) account As with "year"
Almost all data formats are 02/11/2000
, but some of this 02 / November / 2000 < / Code> or
2 / 11/2000
.
The only common thing is that separate data from /
. How can I separate this column using the delimiter?
Surprising But the comment has been correctly stated as "02/11/2000" on November 2, 2000 or 11 What Rvri 2000? In addition, months' names should be spelled correctly and the conversion fails. Since you are collecting stars as stars, this is the chance that there may be entries like November, August etc. You should never store the stars in the form of stars. CAST ('2 / November / 2000),
Select Month (2000 as' datetime)) works
(checks on SQL Server 2008), returns the value 2000-11 -02 00: 00: 00.000 from CAST (Khatadet AS Dinanktaim) "Month", dE (CAIT (Khatadet AS Dinanktaim)) "Day", the year (CAIT (Khatadet AS Dettaim)) "old" account < / Code>
Comments
Post a Comment