You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sql-tools/ImportBK/导入bk网页版.sql

63 lines
3.1 KiB

1 year ago
use KunMing_WeiNaSi_BK
SELECT * FROM gam10_
DECLARE @sql VARCHAR(8000)
SELECT @sql = ''
SELECT @sql = @sql + 'a.' + name + '=b.' + name+ ',' FROM syscolumns WHERE id = object_id('gcm01')
SELECT @sql = LEFT(@sql,len(@sql)-1)
PRINT @sql
DECLARE @sql VARCHAR(8000)
SELECT @sql = ''
SELECT @sql = @sql + name+ ',' FROM syscolumns WHERE id = object_id('gcm03')
SELECT @sql = LEFT(@sql,len(@sql)-1)
PRINT @sql
INSERT gam10(gak00c,gak01c,gak02c,gak03i,gak04i,gak05i,gak06i,gak07f,gak08c,gak09f,gak10f,gak11f,gak12f,gak13f,gak14i,gak15i,gak16f,gak17i,gak18f,gak19f,gak20i,gak21f,gak22f,gak23i,gak24f,gak25i,gak26f,gak27i,gak28f,gak29i,gak30i,gak31i,gak32f,gak33f,gak34f,gak35i,gak36f,gak37i,gak38f,gak40f,gak41i,gak42i,gak43f,gak44i,gak45f,gak46f,gak49i,gak50i,gak51i,gak73f,gak74i,gak75i,gak76i,gak77f,gak78i,gak79i,gak80i,gak81f,gak82c)
SELECT gak00c,gak01c,gak02c,gak03i,gak04i,gak05i,gak06i,gak07f,gak08c,gak09f,gak10f,gak11f,gak12f,gak13f,gak14i,gak15i,gak16f,gak17i=0,gak18f=0,gak19f,gak20i=0,gak21f=0,gak22f,gak23i,gak24f,gak25i=0,gak26f=0,gak27i=0,gak28f=0,gak29i,gak30i,gak31i,gak32f,gak33f,gak34f,gak35i,gak36f,gak37i,gak38f,gak40f,gak41i,gak42i,gak43f,gak44i,gak45f,gak46f,gak49i=0,gak50i=0,gak51i=0,gak73f,gak74i,gak75i,gak76i,gak77f,gak78i,gak79i,gak80i=0,gak81f=0,gak82c=''
FROM gam10_
delete gcm01
INSERT gcm01(gca00c,gca01c,gca02c,gca03i,gca04c,gca05d,gca06d,gca07d,gca08i,gca09c,gca10f,gca11c,gca12c,gca13d,gca14i,gca15i,gca16d,gca17d,gca18c,gca19f,gca20c,gca21d,gca22d,gca23i,gca24f,gca25f,gca26f,gca27c,gca28i,gca29f,gca30c)
SELECT gca00c = compId,gca01c = cardNo,gca02c = cardType,gca03i = cardKind,gca04c = memberNo,gca05d = replace(saleDate,'-','') ,gca06d = replace(activeCardDate,'-',''),
gca07d = replace([expireDate],'-',''),gca08i = [status],gca09c = periodUnit,gca10f = period,gca11c = saleNo,gca12c = '',gca13d = publishcardcompany,
gca14i,gca15i,gca16d = null,gca17d = null,gca18c = '',gca19f = salesAmount,gca20c = salesMan,gca21d = activeCardStartDate,gca22d = activeCardEndDate,gca23i = maxMemberNum,gca24f,gca25f,gca26f,gca27c = remark,gca28i,gca29f = 0,gca30c = ''
FROM gcm01_
WHERE cardNo NOT LIKE 'ɢ<EFBFBD><EFBFBD>%'
INSERT gbm01(gba00c,gba01c,gba03c,gba08c,gba14i,gba21c,gba17d)
SELECT compId,memberId,memberName, mobile,sex,replace(lcBirthday,'-',''),replace(gcBirthday,'-','')
FROM gbm01_
businessPeople,businessPeopleName,cardNo,channel,channelName,compId,gcBirthday,isMassSms,isSms,lcBirthday,maritalStatus,memberId,memberName,mobile,saleStatus,sex,sexText,status,weChatNo,businessType
SELECT * FROM gbm01_
INSERT gcm03(gcc00c,gcc01c,gcc02f,gcc03i,gcc04c,gcc05c,gcc06f,gcc07f,gcc08c,gcc09d,gcc10f,gcc11c)
SELECT compId,cardNo,seqNo,accountType,gcc04c='',gcc05c='',gcc06f=remainAmount,gcc07f = safeRemainAmount,
gcc08c = replace(activeAccountStartDate,'-',''),gcc09d = replace(activeAccountEndDate,'-',''),gcc10f = arrearAmount,
gcc11c = ''
FROM gcm03_
select * from gcm03_
drop table gcm01
ALTER TABLE gam10 DROP
SELECT * FROM gcm01_
SELECT * FROM gbm01_
SELECT name FROM syscolumns WHERE id = object_id('gcm03_')
SELECT * FROM gsm06
SELECT * FROM gsm02
SELECT * FROM gdm01