数据库操作笔记
一段时间来记下的东西
数据库操作(sqlserver2000)
SELECT * FROM dx_com_totalcom WHERE (ISNULL(com_table, '') = '') AND (com_id > 4502789) |
/*update c set c.address_id=a.new_id,c.provice_table=a.province_table,c.address_code=a.code from com_C1_cominfo as c,add_com_view as a where c.com_comddid=a.id*/
select * from com_C1_cominfo as c,add_com as a where c.com_comddid=a.id |
/*update b set b.com_newpointid=a.new_id from dx_com_beijing as b,ad_beijing as a where b.com_pointid=a.id */ /*delete from dx_com_totalcom where com_id>4695060*/
delete from dx_com_shanghai where com_id=6035911
|
/*update c set c.address_id=a.new_id,c.provice_table=a.province_table,c.address_code=a.code from com_C1_cominfo as c,add_com as a where c.com_comddid=a.id*/
/*select * from com_C1_cominfo as c,add_view as a where c.com_comddid=a.id */
/*update c set c.com_comddcode='10011001'+c.com_comddcode from com_C1_cominfo as c*/ /*select * from com_C1_cominfo as c where substring(c.com_comddcode,0,17)='1001100110010012' */ declare @i int set @i=11262823
while @i<11351174 begin set @i=@i+1 print @i insert into dx_com_totalcom (com_table,com_delflag,com_mgrid) values ('xinjiang',0,1) end |
select top 100* from dx_advertise_adp as d order by d.adp_id desc |
/*update b set b.com_newpointid=a.new_id from dx_com_beijing as b,add_bj as a where b.com_pointid=a.id*/
/*select * from dx_com_beijing as b,add_view as a where b.com_pointid=a.id*/
/*update b set b.com_newpointid=a.new_id from dx_com_liaoning as b,add_view as a where b.com_pointid=a.id */ update b set b.com_newpointid=a.new_id from com_C1_cominfo as b,address2 as a where b.com_comddid=a.id |
/* declare @i int set @i=0
while @i<697355 begin set @i=@i+1 print @i insert into dx_advertise_adp (user_id,adp_money,adp_indirectmoney,adp_forusermoney,adp_beforemoney,adp_click,adp_clicked,adp_views,adp_type,adp_typeid,adp_uptypeid,flag,profitManId) values (0,0,0,0,0,0,0,0,'add',@i,0,0,0) end
select top 1 * from dx_advertise_adp order by adp_id desc*/
declare @i int set @i=4502790
while @i<11351174 begin set @i=@i+1 print @i insert into dx_advertise_adp (user_id,adp_money,adp_indirectmoney,adp_forusermoney,adp_beforemoney,adp_click,adp_clicked,adp_views,adp_type,adp_typeid,adp_uptypeid,flag,profitManId) values (0,0,0,0,0,0,0,0,'com',@i,0,0,0) end |
修改数据库名字
EXEC sp_renamedb 'NewCom1', 'dianxun'
Oracle学习笔记
Sqlplusw使用 环境变量 Set pagesize 30; Set linesize 300; 编辑脚本 ed a //创建 @ a //调用 连接用户 Conn system/fantlam //普通管理员 Conn sys/fantlam as sysdba //超级管理员 列出当前用户 Show user 执行上一次命令 用一个“/” 单例函数 转成大写Upper(‘fantlam’) 转成小写select lower(‘FANTLAM’) from dual 单词的第一个字母大写initcap(‘fantlam’) |