将INT转换为VARCHAR SQL [英] Convert INT to VARCHAR SQL
本文介绍了将INT转换为VARCHAR SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Sybase,并且正在执行选择,该选择返回一个称为"iftype"的列,但其类型为int,我需要转换为varchar.当我尝试执行没有转换功能的选择时,出现此错误:
I am using Sybase and I am doing a select which returns me a column called "iftype", but its type is int and I need to convert into varchar. When I try to do the select without the convert function I get this error:
错误代码257,SQL状态37000:不允许从数据类型'VARCHAR'到'INT'的隐式转换.使用CONVERT函数运行此查询.
Error code 257, SQL state 37000: Implicit conversion from datatype 'VARCHAR' to 'INT' is not allowed. Use the CONVERT function to run this query.
我不知道如何实现功能CONVERT
.有人可以帮我吗?
I dont know how to implement the function CONVERT
. Can anyone help me, please ?
推荐答案
使用convert函数.
Use the convert function.
SELECT CONVERT(varchar(10), field_name) FROM table_name
这篇关于将INT转换为VARCHAR SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文