SQL Insert Case When Update

CREATE TABLE LoadTestTable
(
ID INT IDENTITY(1,1),
FIRSTNAME VARCHAR(50),
LASTNAME VARCHAR(50),
GENDER INT,
MOBILE BIGINT,
IDnum VARCHAR(50),
singautre VARCHAR(50),
OPENID VARCHAR(50),
UNIONID VARCHAR(50),
MEMO VARCHAR(50)
); DECLARE @NAME VARCHAR(50)
DECLARE @NAME2 VARCHAR(50)
DECLARE @GENDER INT
DECLARE @HEIGHT INT
DECLARE @MOBILE BIGINT
DECLARE @IDNUM VARCHAR(50)
DECLARE @OPENID VARCHAR(50)
DECLARE @UNIONID VARCHAR(50)
DECLARE @SINGAUTRE VARCHAR(50)
DECLARE @VAR INT
SET @VAR=1000
SET @MOBILE = 21111173440
WHILE @VAR<10000
BEGIN SET @NAME = 'firstname' +CONVERT(VARCHAR(50),@VAR);
SET @NAME2 = 'lastname' +CONVERT(VARCHAR(50),@VAR);
SET @GENDER=1;
SET @HEIGHT=160;
SET @MOBILE = @MOBILE+1;
SET @IDNUM = 'ABCD12341QAZ12' + CONVERT(VARCHAR(50),@VAR);-----18位身份证
SET @OPENID = 'OPENID1111_'+ CONVERT(VARCHAR(50),@VAR);
SET @UNIONID = 'UNIONID1111_'+ CONVERT(VARCHAR(50),@VAR); INSERT LOADTESTTABLE(FIRSTNAME,LASTNAME,GENDER,MOBILE,IDNUM,SINGAUTRE,OPENID,UNIONID)
VALUES(@NAME,@NAME2,@GENDER,@MOBILE,@IDNUM,NULL,@OPENID,@UNIONID) SET @VAR=@VAR+1
END   SELECT * FROM LOADTESTTABLE update LOADTESTTABLE
set GENDER =
case when
(id %2 =0) then '1'
else '2'end update LOADTESTTABLE
set memo =
case when
(gender=1) then 'F'
else 'M'end SELECT * FROM [V_CUSTOMERSUMMARY] where ValidPoints>0 ---54秒

  

上一篇:maven 编译插件


下一篇:[zoj 3774]Power of Fibonacci 数论(二次剩余 拓展欧几里得 等比数列求和)