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 |
taunt
Posting Yak Master
128 Posts |
Posted - 2014-07-15 : 14:23:01
|
Hello I'm trying to convert a nvarchar(50) to numeric(18, 0). This is my query:UPDATE AupdateSET VID = Label.VIDFROM Label INNER JOIN Aupdate ON Label.LabelCodeA = Aupdate.LabelAbbr The issue is Label.VID is nvarchar(50) and Aupdate.VID is numeric(18, 0). What would be the best way to convert nvar to numeric? Should I use cast? The odd thing is that it use to work and all the sudden I get that error. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-07-15 : 14:36:12
|
Yes CAST or CONVERT, but I suspect it's a data issue where it can't be converted to numeric. You can use the ISNUMERIC function to find the varchar data that is not numeric.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
taunt
Posting Yak Master
128 Posts |
Posted - 2014-07-15 : 14:44:04
|
Yep, I looked at the Label table and someone put letters in the field I was trying to convert to a numeric. That was the issue. I fixed the bad data and it worked fine.Thanks |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|