易截截图软件、单文件、免安装、纯绿色、仅160KB

MSSQL中计算两个日期之间相隔 xx天xx小时xx分xx秒

 DECLARE @dt1 AS datetime, @dt2 AS datetime;
SELECT @dt1 = '2008-8-4 9:36:41', @dt2 = '2008-8-2 9:33:39';
DECLARE @Days AS int, @Hours AS int, @Minutes AS int, @Seconds AS int;
SET @Seconds = DATEDIFF( second, @dt2, @dt1);
SET @Days = @Seconds / (24 * 60 * 60)
SET @Seconds = @Seconds - @Days * 24 * 60 * 60
SET @Hours = @Seconds / (60 * 60);
SET @Seconds = @Seconds - @Hours * 60 * 60
SET @Minutes = @Seconds / 60;
SET @Seconds = @Seconds - @Minutes * 60;
SELECT CONVERT(varchar(10), @Days ) + '天'
          + CONVERT(varchar(10), @Hours ) + '小时'
          + CONVERT(varchar(10), @Minutes ) + '分'
          + CONVERT(varchar(10), @Seconds ) + '秒';


相关文档:

MSSQL 分布式事务管理

   当数据服务器和Web服务器部署在不同的服务器上时,会用到分布式事务,需要对两个服务器的MSDTC进行配置。
    打开“管理工具――组件服务”,以此打开“组件服务――计算机”,在“我的电脑”上点击右键。在MSDTC选项卡中,点击“安全配置”按钮。 ......

.bat启动数据库服务(MSSQL,Oracle)

 @echo off
:dosmenu
REM 选择菜单
echo  Windows 服务启动或关闭 By hope 2008年2月7日     
echo.
echo [1]启动Sql Server2005   [2]关闭Sql Server2005
echo [3]启动Oracle9i         [4]关闭Oracle9i
echo.
echo  ......

How is MSSQL using memory?


How is MSSQL using memory?
http://www.sqlhacks.com/Administration/Memory-Usage
Memory is one the most important factor affecting MSSQL performance.
As an administrator, you should be monitoring the memory
regularly. When Microsoft SQL Server runs out of memory, it will use
virtual memory: ie: ......

mssql row_number() partition 使用方法理解

Sql2005中使用ow_number() partition进行分组实验,
SQL:
select * from stu
select id,row_number() over (partition by snm order by id) from stu
结果:
id      snm
----------------
111 111V
111 111W
222 222N
333 3123
444 3123
555 3123
666 3232
777 3232
--分组后的结果
id &n ......

用作业实现自动备份MSSQL数据库到远程服务器

--此代码实现SQL数据库远程备份,放到作业里面执行可以自动备份数据库、自动删除@keepNDays天前备份。
--此代码将本地所有的用户数据库备份到共享目录“\\backupServerIp\ShareName\数据库备份”下。
--并删除天前的备份文件。要备份成功必须能够对共享目录有操作权限!

sp_configure 'xp_cmdshell',1 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号