SQL中只有两列数据(字段1,字段2),将其相同字段1的行转列 转换前: 转换后: --测试数据 if not object_id(N'Tempdb..#T') is null drop table #T Go Create table #T([MDF_LOT_NO] int,[ERP_MODE_CD] int) Insert #T , union all , union all , union all , Go --测试数据结束 DECLARE @name VARCHAR(max),@sql
Sub Md() ' ' Macro1 Macro ' 宏由 BX 录制,时间: 2012-6-8 ' 宏中的列数可以输入 A - IV 也可以输入 1-256 ' Dim i%, j%, i1%, j1%, i2%, j2% myi = UCase(InputBox("第一列")) myj = UCase(InputBox("第二列")) ' '************************************ If myi Like "[A-Z]
create table a( s nvarchar null, ss nvarchar null, f decimal(18,1) null, ff decimal(18,1) null,)INSERT INTO a VALUES(2,2,6.0,6.0);INSERT INTO a VALUES(1,4,1.3,1.4); select cast(s as varchar)+ss as str from a select cast(f as varchar(10))+''+cast(ff a