--创建测试表 CREATE TABLE [dbo].[TestRows2Columns]( [Id] [,) NOT NULL, [UserName] [nvarchar]() NULL, [Subject] [nvarchar]() NULL, [Source] [numeric](,) NULL ) GO --插入测试数据 INSERT INTO [TestRows2Columns] ([UserName],[Subject],[Source]) SELECT N UNION ALL SE…