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 |
alejo46
Posting Yak Master
157 Posts |
Posted - 2014-07-01 : 11:44:53
|
Good Morning, i need your help pls,While executing a SP failed with an error:Error converting data type varchar to bigintPRO_DETALLE_ALTAMIRA_POGE_TARJETAS 2738,748523,''OutPut: UPDATE DETALLE_ALTAMIRA_POGE_TARJETASSET IRM_ABONADO = TPT.IRM_ABONADO,FEC_ACTUALIZACION = GETDATE ()FROM DETALLE_ALTAMIRA_POGE_TARJETAS DPTINNER JOIN TEMP_ALTAMIRA_POGE_TARJETAS TPTON TPT.NUM_CELULAR = DPT.NUM_CELULARAND TPT.IRM_ABONADO <> DPT.IRM_ABONADO1 row(s) affected)Server: Msg 8114, Level 16, State 5, Line 1Error converting data type varchar to bigint.THIS IS THE STRUCTURE FOR BOTH TABLES:DETALLE_ALTAMIRA_POGE_TARJETAS|dbo|user table|2008-08-06 17:30:39.997 Column_name|Type|Computed|Length|Prec|Scale|Nullable|TrimTrailingBlanks|FixedLenNullInSource|CollationNUM_CELULAR|bigint|no|8| | |yes|(n/a)|(n/a)|IRM_ABONADO|varchar|no|8| | |yes|no|no|SQL_Latin1_General_CP1_CI_ASFEC_INSERCION|datetime|no|8| | |yes|(n/a)|(n/a)|FEC_ACTUALIZACION|datetime|no|8| | |yes|(n/a)|(n/a)|Identity|Seed|Increment|Not For ReplicationNo identity column defined.|||RowGuidColNo rowguidcol column defined.TABLE TEMP_ALTAMIRA_POGE_TARJETAS|dbo|user table|2006-09-28 18:29:04.303Column_name|Type|Computed|Length|Prec|Scale|Nullable|TrimTrailingBlanks|FixedLenNullInSource|CollationNUM_CELULAR|varchar|no|15| | |yes|no|no|SQL_Latin1_General_CP1_CI_ASIRM_ABONADO|varchar|no|8| | |yes|no|no|SQL_Latin1_General_CP1_CI_ASIdentity|Seed|Increment|Not For ReplicationNo identity column defined.||| RowGuidColNo rowguidcol column defined.THS IS A SAMPLE FOR BOTH TABLES:table TEMP_ALTAMIRA_POGE_TARJETASNUM_CELULAR|IRM_ABONADO3155210020|SDP0043157873500|SDP0043185787120|SDP0063165178340|SDP006table DETALLE_ALTAMIRA_POGE_TARJETASNUM_CELULAR|IRM_ABONADO|FEC_INSERCION|FEC_ACTUALIZACION3184448621|SDP006|2012-02-14 10:10:26.717|2012-02-14 10:10:26.7173184339720|SDP005|2012-02-14 10:10:26.717|2012-02-14 10:10:26.7173183013770|SDP006|2012-02-14 10:10:26.717|2013-09-17 06:16:11.3473184305879|SDP006|2012-02-14 10:10:26.717|2014-03-16 11:25:56.5903184339088|SDP005|2012-02-14 10:10:26.717|2012-02-14 10:10:26.7173184787782|SDP004|2012-02-14 10:10:26.717|2012-10-07 06:49:34.797Acording the yielded error this problem is likely to be on DATA from table TEMP_ALTAMIRA_POGE_TARJETAS and field NUM_CELULAR while converting to datatype bigint, isnt it ? if so How do i identify invalida data on field TEMP_ALTAMIRA_POGE_TARJETAS.NUM_CELULAR in order to be discarded ?Thanks for your help in advanced |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-07-01 : 12:37:47
|
You can use the ISNUMERIC() function to determine which rows are not valid.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2014-07-01 : 12:46:13
|
WHERE Col1 NOT LIKE '%[^0-9]%' -- Gives all rows with positive integer values only Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
|
|
|
|
|