在表中,2个字段的ID为int,Number的大小为int小,我想将两个字段连接起来并显示为字符串
eg: ID = 101 and Number = 9 output : 101.9
是否要在ID和数字之间添加点?如何在SQL中查询?
你可以科协的整数字段为varchar,然后将它们连接起来,只要你想。
DECLARE @ID INT DECLARE @Number INT SET @ID = 101 SET @Number = 9 SELECT CAST(@ID AS VARCHAR(10) ) +'.'+ CAST(@Number AS VARCHAR(10) )