1
I have a seemingly simple question, but I’ve been racking my brain for a few hours, so I decided to ask for help.
When executing the below query it normally executes.
Select campo1, campo2 from tabela;
I got the following result:
campo 1 = 296998.00 ("sempre um numero")
campo 2 = 2,5 (Vários resultados, compostos por caráteres especiais, "%", ",", "Letras" e etc..
I just want to do the campo1 * campo2
generating a third field resulting from the operation.
Select campo1, campo2, (campo1 * campo2) as vlr_taxa from tabela;
However this query returns the following error:
Message 8114, Level 16, Status 5, Line 2 Error Converting data type sweep to Numeric.
I researched a lot on the internet and here in the community, but I could not find a simple solution to the case.
It follows publications I’ve seen, but they haven’t solved my problem.
You can pass a list of data you have in
campo1
andcampo2
?– David
Thank you for intersere in helping. I am attaching an Excel with 100 lines that extracts from the database.
– Felipe Augusto Violin
The following is a link to the file - https://drive.google.com/file/1edbyqHPe0h5DnSOIROJwSWzUAKYTtEwV/view?usp=sharing
– Felipe Augusto Violin
From what I’ve seen of the column data, you’ll have to do some
replace
(for example by removing the%
), to normalize the data, ie leave in the same pattern, then make the change as suggested by Ronaldo. I strongly recommend typing this column asdecimal
, so it doesn’t happen that and in need of conversions.– David
Again thanks for the feedback, I’m beginner and kind of need to see designed to understand. Would you have some example of how I could use replace for this function?
– Felipe Augusto Violin