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 |
|
bendertez
Yak Posting Veteran
94 Posts |
Posted - 2008-03-19 : 11:42:14
|
| HelloI'm struggling with this one.......!!I need to format a VARCHAR field storing a date value in to a different format.The field currently holds date data in the format 01/01/2008 but I want to return 010108.The nearest i'm coming out with is 01012008 by using the REPLACE function, but can't seem to get out the required format.It is not a date field and I can't change it to a date field, due to other procedures relying on it.Can anyone help??Thank you |
|
|
jrogers
Starting Member
34 Posts |
Posted - 2008-03-19 : 11:53:31
|
| declare @value varchar(10)set @value = '01/01/2008'select substring(@value,1,2) + substring(@value,4,2) + substring(@value,9,2) |
 |
|
|
|
|
|