随笔- 133
文章- 2
评论- 366
阅读-
20万
随笔分类 - 数据库
拆分字符串,并存入临时表中
摘要:create table #mytable(account nvarchar(10))declare @oldstring as nvarchar(3000)declare @tempstring as nvarchar(10)set @oldstring='10302299,10311441,10312196,10300104,10300297,10300381,10300509,103005...
阅读全文
sql 计算某个时间段周六,日总数
摘要:Create PROCEDURE Busdays @from_dt datetime,@to_dt datetime ,@wkends int outputASDECLARE@days int,--天数@dp int ,--星期?@cnt int --计数set @wkends=0 --非工作日天数set @cnt=0set @days=datediff(d,@from_dt,@to_dt)whi...
阅读全文
dts导出到excel
摘要:表:EXEC master..xp_cmdshell 'bcp uttemp.dbo.abc out c:\temp01.xls -c -q -S"192.168.0.157" -U"sa" -P"777"'sql语句: EXEC master..xp_cmdshell 'bcp "select dt from uttemp.dbo.abc" queryout c:\temp01.xls -c -...
阅读全文
朋友问的一个关于group by的sql
摘要:提问: 一个表有三个字段id,dt,d 分别存放id,时间,数值 id dt d 1 2004-08-11 12:12:00.000 9 2 2005-09-11 12:08:00.000 2 3 2005-08-11 12:12:00.000 6 4 2005-09-11 12:12:00.000 10 5 2005-08-11 12:12:00.000...
阅读全文