SQL SERVER 中datetime 和 smalldatetime类型
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋体;
mso-font-kerning:1.0pt;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:42.55pt;
mso-footer-margin:49.6pt;
mso-paper-source:0;
layout-grid:15.6pt;}
div.Section1
{page:Section1;}
-->
datetime
和 smalldatetime
代表日期和一天内的时间的日期和时间数据类型。
Microsoft SQL Server
用两个 4
字节的整数内部存储
datetime
数据类型的值。第一个 4
字节存储 base date
(即 1900
年 1
月 1
日)之前或之后的天数。基础日期是系统参考日期。不允许早于 1753
年 1
月 1
日的
datetime
值。第一个4
字节:1900
年1
月1
日当日为0
;之前的日期是负数;之后日期是正数。另外一个 4
字节存储以午夜后3
1/3
毫秒数所代表的每天的时间。
smalldatetime
数据类型存储日期和每天的时间,但精确度低于 datetime
。
SQL Server
将 smalldatetime
的值存储为两个 2
字节的整数。第一个 2
字节存储
1900
年 1
月 1
日后的天数。另外一个 2
字节存储午夜后的分钟数。日期范围从1900
年 1
月 1
日到 2079
年 6
月 6
日,精确到分钟。
可以将这两种类型转换成float
浮点数,
其中整数部分就是对应的日期字节,
相关文档:
SQL注入攻击的危害性很大。在讲解其防止办法之前,数据库管理员有必要先了解一下其攻击的原理。这有利于管理员采取有针对性的防治措施。
一、 SQL注入攻击的简单示例。
statement := "SELECT * from Users WHERE Value= " + a_variable + "
上面这条语句是很普通的一条SQL语句,他主要实现的功能就是 ......
SQL时间函数
--日期转换参数,值得收藏
select CONVERT(varchar, getdate(), 120 )2004-09-12 11:06:08
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')20040912110608
select CONVERT(varchar(12) , getdate(), 111 )2004/09/12
select CONVERT(varchar(12) , get ......
最后一课 异常处理本章重点:
1、定义PLSQL异常
2、列举不同的异常处理方法
3、捕获非预期的错误
4、描述异常的影响
5、定制异常的返回信息 一、PLSQL异常处理
异常是由ORACLE错误或显式的抛出一个错误产生的。
如何处理:
用一个处理程序来捕获它;
将它传递 ......