Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / General / Other SQL Server Topics / July 2005

Tip: Looking for answers? Try searching our database.

converting field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Job - 29 Jul 2005 16:39 GMT
I have a table that has a units column that is varchar because some of the
units have text in them.  I'm attempting to update the units into a new
field that is called Fxd_Units.

Update Tbl_MyTable
Set Fxd_Units = Cast(TxnUnits as Numeric)
Where TxnUnits not like '%M%'

This throws the error converting error.

Any help is appreciated.

Cheers,

Job
Job - 29 Jul 2005 17:38 GMT
This works,

Update Tbl_MyTable
Set Fxd_Units = Cast(TxnUnits as Numeric)
Where IsNumeric(TxnUnits)=1

>I have a table that has a units column that is varchar because some of the
>units have text in them.  I'm attempting to update the units into a new
[quoted text clipped - 11 lines]
>
> Job
Louis Davidson - 29 Jul 2005 18:19 GMT
Look at (and then post if needed :) the results of:

select txtUnits
from tbl_mytable
where isNumeric(txtUnits)  =0

You might need to use REPLACE () to get rid of some fun

Signature

----------------------------------------------------------------------------
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP

> This works,
>
[quoted text clipped - 17 lines]
>>
>> Job
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.