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)
 remove all decimals

Author  Topic 

dpcamp
Starting Member

10 Posts

Posted - 2009-07-17 : 12:22:14
This seems like an easy one but i can't seem to find the right query anywhere for what i want to do.
I have a small table with a date in decimal format
Select CV_ID from TBLConfiguratorVersion

returns 6.04.09

how do i set up the query to return it as
60409

thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-17 : 12:27:24
replace(CV_ID, '.', '')


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

dpcamp
Starting Member

10 Posts

Posted - 2009-07-17 : 12:45:53
Sorry i keep getting errors when i try to run it, how am i supposed to place that into the existing query?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-17 : 12:46:50
[code]Select replace(CV_ID, '.', '') from TBLConfiguratorVersion[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

dpcamp
Starting Member

10 Posts

Posted - 2009-07-17 : 12:53:43
thats what i did, didn't work the first few times for some reason. probably a typo... thanks
Go to Top of Page

Jeff Moden
Aged Yak Warrior

652 Posts

Posted - 2009-07-19 : 20:14:09
Ugh!... That also means that the date is stored as a VARCHAR. That would be the first thing to repair.

--Jeff Moden
"Your lack of planning DOES constitute an emergency on my part... SO PLAN BETTER! "
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row"

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-07-20 : 04:24:36
quote:
Originally posted by dpcamp

This seems like an easy one but i can't seem to find the right query anywhere for what i want to do.
I have a small table with a date in decimal format
Select CV_ID from TBLConfiguratorVersion

returns 6.04.09

how do i set up the query to return it as
60409

thanks


You should always use proper Datetime datatype to store dates and let the front end application do the formation. If you can't change the datatype, try using new column with datetime datatype;update values on that and use that column further

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -