If both DECIMAL(38,4) and try_cast are not working for you, as mentioned by Erland, you have to filter out the data who has the value from - 10^38 +1 through 10^38 - 1. When maximum precision is used, valid values are from - 10^38 +1 through 10^38 - 1. Then we could look into it and find out any possible solution.ĭecimal )] and numeric )]įixed precision and scale numbers. It is recommended to post DDL of your table together with INSERT statements with sample data. Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. If the answer is helpful, please click " Accept Answer" and upvote it. If above is not working, then you could have a try to replace cast with try_cast as below since try_cast returns null if a value is failed to cast to the specified data type. In this case, you could firstly try to replace DECIMAL(30,4) with DECIMAL(38,4) as below since the maximum allowed size given to the type 'decimal' is ( 38). Know your data, know your requirements, know what your requirement is. The string '00001' is not logically the same string as '1' but convert them to numbers and they do 'match'. Converting to any numeric value runs the risk of error (as you found) as well as incorrect results. Thank you so much for posting here in Microsoft Q&A. You have a varchar column, so use varchar literals.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |