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 ) + '秒';
相关文档:
数据类型
类型
描述
bit
整型
bit 数据类型是整型,其值只能是0、1或空值。这种数据类型用于存储只有两种可能值的数据 ,如Yes 或No、True 或Fa lse 、On 或Off
int
整型
int 数据类型可以存储从- 231( ......
@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?
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: ......
php教程 调用mssql存储过程实例应用
用mssql_init语句用于初始化存储过程,而后调用mssql_bind语句指定存储过程参数,最后调用mssql_execute执行存储过程。
*/
//连接mssql数据库教程服务器
$link = mssql_connect("127.0.0.1", "sa", "sa") or die("Can't connect sql server");
mssql_sele ......
如何创建链接服务器
IF EXISTS (SELECT srv.name from sys.servers srv WHERE srv.server_id != 0 AND srv.name = N'链接服务器名')
EXEC master.dbo.sp_dropserver @server=N'链接服务器名'', @droplogins='droplogins'
GO
EXEC master.dbo.sp_addlinkedserver
@server = N'链接服务器名'', @srvproduct= ......