2
Concatenate a variable and a message in the insert
? Example:
declare a int;
set a = 2;
insert into tb_usuario values ('a' + 'fez tal coisa');
2
Concatenate a variable and a message in the insert
? Example:
declare a int;
set a = 2;
insert into tb_usuario values ('a' + 'fez tal coisa');
0
Yes, have, you need to use a function for this, in case it is the CONCAT()
. Then it would look something like this:
insert into tb_usuario values (concat('a', 'fez tal coisa'));
Although this case does not make much sense to do so, I hope you are using a field or variable there. Who knows want to do this:
insert into tb_usuario values (concat(a, 'fez tal coisa'));
I put in the Github for future reference.
This will insert 2fez alguma coisa
.
Browser other questions tagged mysql sql database sql-insert mysql-workbench
You are not signed in. Login or sign up in order to post.
In this case you are concatenated the character 'a' and not the variable a. Try CONCAT(a, 'did such a thing').
– anonimo
it worked. thank you
– Barbara Hellen