4
Hello, I have two banks BDMCOM1 and BDMCOM1_V3_ALEA, both of which have a table called Saldodeproducts and the field called Codigodoproduto, in the table of the bank BDMCOM1, Codigodoproduto has 5 digits, in the table of the other bank the codeDProduct has 8 digits...
I would like to select all table data SaldoDeProdutos, which has a column CodigoDoProduto whose field format is something like 00001, and insert into the other bank table BDMCOM1_V3_ALEA already including 3 zeroes left to complete the 8 digits.
Gypsy, it didn’t work out here, let me go into it... A bank eh BDMCOM1 and has the table Saldodeproducts and a field called Codigodoproduct with varchar 5, the other bank is the BDMCOM1_V3_ALEA and has the table Saldodeproduct and the field Codigodoproduct with varchar 8. I want to take for example the 00001 of BDMCOM1 and put in BDMCOM1_V3_ALEA so: 00000001. You can edit the answer in this pattern?
– JdsMedeirosBR
Can you please edit your question with these details?
– Leonel Sanches da Silva
Okay, already Edited out.
– JdsMedeirosBR
@Jadsonmedeiros See if it’s clearer now.
– Leonel Sanches da Silva
If I didn’t have the light on.
– Marco Souza
Incorrect syntax near the keyword 'FROM'.
– JdsMedeirosBR
Yes, but did you put the rest of the columns or did you just copy and paste what I put?
– Leonel Sanches da Silva
I pasted the code and replaced a few things, then the error was only in FROM, in case insert more columns is optional and no error would occur if you have only one, no?
– JdsMedeirosBR
The amount of columns in the
INSERTmust be equal to the number of columns ofSELECT. There must be no comma between the last column andFROM.– Leonel Sanches da Silva
Blz, but late I see it here, obg.
– JdsMedeirosBR
Gypsy, it worked, obg, it was just the same comma, but now I came across a field with quantity 1,00 and another field 1,000, in case I tried to adapt this excerpt: REPLICATE('0', 4 - LEN, and did not roll, in this case it is to take the 1,000 and send to the other bank as 1,00.
– JdsMedeirosBR
I think it’s worth asking another question, no?
– Leonel Sanches da Silva