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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Removing Special Character

Author  Topic 

velvettiger
Posting Yak Master

115 Posts

Posted - 2008-05-14 : 15:57:19
Hi Guys,

I have a table which contains a column consisting of some date fields and I would like to remove all of the '-' characters from this particular row of the table. Does anyone have any ideas.

Eg 1985-05-25 I would like the above date to look like this 19850525

Thanks in advance

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-05-14 : 16:01:01
check out REPLACE in Books Online.

replace(<column>, '-', '')

Be One with the Optimizer
TG
Go to Top of Page

cat_jesus
Aged Yak Warrior

547 Posts

Posted - 2008-05-14 : 16:38:49
If the data is stored in a datetime field then it's just a matter of displaying the date in the format that you want it. While it's best to do that kind of formatting in the client application layer you can do it in SQL with convert. See Books Online for details.




An infinite universe is the ultimate cartesian product.
Go to Top of Page

velvettiger
Posting Yak Master

115 Posts

Posted - 2008-05-15 : 08:36:07
Thanks guy. I got it done.
Go to Top of Page

cat_jesus
Aged Yak Warrior

547 Posts

Posted - 2008-05-16 : 12:42:26
I'm not your guy, friend.




An infinite universe is the ultimate cartesian product.
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-05-16 : 12:57:56
I'm not your friend, buddy.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -