Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
pascal_jimi
Posting Yak Master
167 Posts |
Posted - 2014-12-26 : 05:31:42
|
declare @new table(id int not null identity(1,1),dat char(10))insert into @newselect'111214'unionselect'121214'select cast(dat as datetime)from @new-----------------------2011-12-14 00:00:00.0002012-12-14 00:00:00.000but me need results it2014-12-112014-12-12thanks allhttp://sql-az.tr.gg/ |
|
sunder.bugatha
Yak Posting Veteran
66 Posts |
Posted - 2014-12-26 : 07:44:56
|
cast((SUBSTRING(dat,5,2)+ SUBSTRING(dat,3,2)+SUBSTRING(dat,1,2)) as date) from new |
|
|
pascal_jimi
Posting Yak Master
167 Posts |
Posted - 2014-12-29 : 02:48:06
|
thanks but i was created this script and succefully was running declare @new table(id int not null identity(1,1),dat char(10))insert into @newselect'111214'unionselect'121214'select CONVERT(datetime,SUBSTRING(dat,1,2)+'-'+SUBSTRING(dat,3,2)+'-'+SUBSTRING(dat,5,2),5)from @newhttp://sql-az.tr.gg/ |
|
|
|
|
|
|
|