求一段T-SQL语句实现多个整数转char(n)类型字段的数据
在1~33 中任意给定4个数字,请将这些数字合并转换为一个char(8)类型的字符串,如给1、4、10、12,可在数据表tb_num46的类型为char(8)的num4字段中插入一条记录,其中num4字段的字符串为"01041012"。求能实现这样功能的T-SQL语句段或存储过程。
其他答案
begindeclare @a1 int,@a2 int,@a3 int,@a4 intdeclare @result char(8)set @a1=1+cast(rand()*33 as int) ---1-33随机数set @a2=1+cast(rand()*33 as int) ---1-33随机数set @a3=1+cast(rand()*33 as int) ---1-33随机数s 展开
2010-12-19 16:18
来自北京市
评论(0)赞(0)点赞赞(0)
免责声明:问答内容均来源于互联网用户,房天下对其内容不负责任,如有版权或其他问题可以联系房天下进行删除。