累积SQL语句

查看某数据库下数据表的个数及数据表的名字

SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES;
SELECT * FROM INFORMATION_SCHEMA.TABLES;
SELECT COLUMN_NAME  FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'SF_JLB';--查询表sf_jlb的所有列名

 

select * from dbo.SF_JLB where SF_SFRQ  BETWEEN  '2023-04-1' and '2023-04-30'
select * from dbo.SF_JLB where SF_SFRQ>='2023-04-1' and  SF_SFRQ<='2023-04-30'
update dbo.SF_JLB set SF_SFRQ=SF_SFRQ-30 where SF_SFRQ>='2023-04-1' and  SF_SFRQ<='2023-04-30'
UPDATE dbo.SF_JLB  SET SF_SFRQ = dateadd(month,-1,SF_SFRQ)  where SF_SFRQ>='2023-04-1' and  SF_SFRQ<='2023-04-30'
-------------------------------------------------------------------------------------------------------------------------------------------------
select * from dbo.SF_JLB where SF_SFRQ>='2023-04-01' and SF_SFRQ<='2023-05-01'
delete from dbo.SF_JLB where SF_SFRQ>='2023-04-01' and SF_SFRQ<='2023-05-01'
insert into dbo.SF_JLB select * from ChargeDB_new2.dbo.SF_JLB where SF_SFRQ>='2023-04-01' and SF_SFRQ<='2023-05-01'

 

posted @ 2024-08-31 21:18  techNote  阅读(3)  评论(0编辑  收藏  举报