Friday, December 18, 2015

Re: [google-cloud-sql-discuss] Re: converter integer para string consulta

Thank your all

----
Cordialmente,
Gilson Luiz Rauschkolb

Em 18/12/2015 20:45, "Razvan Musaloiu-E." <razvanm@google.com> escreveu:
I think CAST (or CONVERT) is what you need.

Here is an example:

mysql> CREATE TABLE t(i INT);
Query OK, 0 rows affected (0.50 sec)

mysql> INSERT INTO t VALUES (1), (2);
Query OK, 2 rows affected (0.24 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> SELECT CAST(i AS CHAR) FROM t;
+-----------------+
| CAST(i AS CHAR) |
+-----------------+
| 1               |
| 2               |
+-----------------+
2 rows in set (0.09 sec)

mysql> 


-- Razvan ME


On Thursday, December 17, 2015 at 9:01:56 AM UTC-8, Danny Xu wrote:
Hi,

You could add a new field to the table. Copy the original integer field as string type to the new field. Delete the old field in integer. Then you can use the new field in the future.

On Wednesday, December 16, 2015 at 2:39:15 PM UTC-8, Gilson Rauschkolb wrote:
Boa Noite,

Pessoal estou com um dilema, tenho um campo em uma tabela que é integer, e na consulta gostaria de substituir o valor por um texto.

como faço isso?

Obrigado

--
You received this message because you are subscribed to a topic in the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-cloud-sql-discuss/dfDzqSaDhH4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/e1aa0010-21f3-450b-b745-3f5bb781336e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/CAEGOMoVDqsb6_buaytb3agHT%3DCrGWwurLu98no86M%2By4-t94OQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment