sql语句备份

来源:互联网 发布:淘宝商品被下架找不到 编辑:程序博客网 时间:2024/06/06 07:45
--  ①、首先,执行 cnn_csfg.sql  里的语句 


--  ②、执行修改p_notification表的语句
alter table p_notification add column NSW_Flag bit DEFAULT 0;             --  1:数据从纳税服务网导入  0:数据从其它来源导入
alter table p_notification add column NSW_FirstCategory varchar(100) DEFAULT NULL;   -- 纳税服务网数据-一级类别
alter table p_notification add column NSW_SecondCategory varchar(100) DEFAULT NULL;  -- 纳税服务网数据-二级类别
alter table p_notification add column NSW_ArticleNumber varchar(100) DEFAULT NULL;  -- 纳税服务网数据-文号
alter table p_notification add column NSW_Province varchar(50) DEFAULT NULL;  -- 纳税服务网数据-省份
alter table p_notification add column NSW_City  varchar(50) DEFAULT NULL;  -- 纳税服务网数据-城市
alter table p_notification add column NSW_BusinessRegion varchar(200) DEFAULT NULL;  -- 纳税服务网数据-行业
alter table p_notification add column NSW_Source  varchar(200) DEFAULT NULL;  -- 纳税服务网数据-数据来源
alter table p_notification add column NSW_Validation  varchar(20) DEFAULT NULL;  -- 纳税服务网数据-有效性


-- ③、开始插入表里的数据到p_notification表里
INSERT INTO p_notification (
NSW_Flag,
title,
NSW_FirstCategory,
NSW_SecondCategory,
sendTime,
link,
NSW_ArticleNumber,
NSW_Province,
NSW_City,
NSW_BusinessRegion,
NSW_Source,
NSW_Validation,
infoType,
STATUS,
sender,
pubScope,
sendUnit,
primaryType,
inputTime
) SELECT
  b'1' AS NSW_Flag,
cnn_csfg.title AS title,
cnn_csfg.types1 AS NSW_FirstCategory,
cnn_csfg.types2 AS NSW_SecondCategory,
cnn_csfg.time AS sendTime,
CONCAT(
'http://www.cnnsr.com.cn',
cnn_csfg.address
) AS link,
cnn_csfg.wenhao AS NSW_ArticleNumber,
cnn_csfg.pro AS NSW_Province,
cnn_csfg.city AS NSW_City,
cnn_csfg.hangye AS NSW_BusinessRegion,
cnn_csfg.source AS NSW_Source,
cnn_csfg.valid AS NSW_Validation,
'政策法规' AS infoType,
'1' AS STATUS,
'1' AS sender,
'100000' AS pubScope,
'100000' AS sendUnit,
'20' AS primaryType,
now() AS inputTime
FROM
cnn_csfg;
0 0
原创粉丝点击