Chen Jian

SQL SERVER 数据类型大全

红色部分为每种类型转换为char时,需用的数据长度 Microsoft? SQL Server? 2000 具有以下大小的整型数据类型:                                                                                                                                                                bigint                                                                                                        长度为 8 个字节,存储从 –2^63 (-9,223,372,036,854,775,808) 到 2^63-1 (9,223,372,036,854,775,807) 的数字。                                                                                                                   integer 或 int   <font color=red>char(16)</font>                                                                                          长度为 4 个字节,存储从 -2.147.483.648 到 2.147.483.647 的数字。                                                                                                                                                            smallint                                                                                                      长度为 2 个字节,存储从 –32,768 到 32,767 的数字。                                                                                                                                                                         tinyint                                                                                                       长度为 1 个字节,存储从 0 到 255 …

SQL SERVER 数据类型大全 Read More »

sql server 中按日期(只精确到日)选择记录的最优方式

sql server中的字段是datetime类型,而用户提出的选择条件是以天为单位的,未精确到时分秒等 经过试验,我个人觉是最优方式是       select * from tt where date between ‘2007-02-13 00:00:00.000’ and ‘2007-02-13 23:59:59.999’     比起  … where convert(datetime, convert(varchar,date ,112), 112) = ‘2007-02-13’ 要快多了