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]…
1前话 项目内实现了一新功能:克隆数据库. 2目标 克隆并非用SQLSERVER克隆,故完毕后需要检查各表内一些数据与原表一致性.一些表中的某一些列容许不一致. 3实现 将两表的需要检查的几列取出,相加每行checksum作为本表数据特征,对比. 4代码 declare @col varchar(200) set @col='' select @col=@col+','+name from syscolumns where id=object_id('表') and name<>'不要的列'…
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…
library(dplyr) unite(mtcars, "vs_am", vs, am) Merging Data Adding Columns To merge two data frames (datasets) horizontally, use the merge function. In most cases, you join two data frames by one or more common key variables (i.e., an inner joi…
Sub FillNewToYellow() Dim dic Dim oldArr(), updatedArr() On Error Resume Next If Worksheets("old") Is Nothing Then MsgBox "Missing old sheet" ElseIf Worksheets("updated") Is Nothing Then MsgBox "Missing updated sheet&quo…