MSSQLÊý¾ÝÀàÐͼ°³¤¶ÈÏÞÖÆÏêϸ˵Ã÷
SQL Server ÌṩϵͳÊý¾ÝÀàÐͼ¯£¬¶¨ÒåÁË¿ÉÓë SQL Server Ò»ÆðʹÓõÄËùÓÐÊý¾ÝÀàÐÍ¡£ÏÂÃæÁгöϵͳÌṩµÄÊý¾ÝÀàÐͼ¯¡£
¿ÉÒÔ¶¨ÒåÓû§¶¨ÒåµÄÊý¾ÝÀàÐÍ£¬ÆäÊÇϵͳÌṩµÄÊý¾ÝÀàÐ͵ıðÃû¡£ÓйØÓû§¶¨ÒåµÄÊý¾ÝÀàÐ͵ĸü¶àÐÅÏ¢£¬Çë²Î¼û sp_addtype ºÍ´´½¨Óû§¶¨ÒåµÄÊý¾ÝÀàÐÍ¡£
µ±Á½¸ö¾ßÓв»Í¬Êý¾ÝÀàÐÍ¡¢ÅÅÐò¹æÔò¡¢¾«¶È¡¢Ð¡ÊýλÊý»ò³¤¶ÈµÄ±í´ïʽͨ¹ýÔËËã·û½øÐÐ×éºÏʱ£º
ͨ¹ý½«Êý¾ÝÀàÐ͵ÄÓÅÏÈ˳Ðò¹æÔòÓ¦Óõ½ÊäÈë±í´ïʽµÄÊý¾ÝÀàÐÍÀ´È·¶¨ËùµÃÖµµÄÊý¾ÝÀàÐÍ¡£Óйظü¶àÐÅÏ¢£¬Çë²Î¼ûÊý¾ÝÀàÐ͵ÄÓÅÏÈ˳Ðò¡£
Èç¹û½á¹ûÊý¾ÝÀàÐÍΪ char¡¢varchar¡¢text¡¢nchar¡¢nvarchar »ò ntext£¬Ôò½á¹ûÖµµÄÅÅÐò¹æÔòÓÉÅÅÐò¹æÔòµÄÓÅÏÈ˳Ðò¹æÔò¾ö¶¨¡£Óйظü¶àÐÅÏ¢£¬Çë²Î¼ûÅÅÐò¹æÔòµÄÓÅÏÈ˳Ðò¡£
½á¹ûµÄ¾«¶È¡¢Ð¡ÊýλÊý¼°³¤¶ÈÈ¡¾öÓÚÊäÈë±í´ïʽµÄ¾«¶È¡¢Ð¡ÊýλÊý¼°³¤¶È¡£Óйظü¶àÐÅÏ¢£¬Çë²Î¼û¾«¶È¡¢Ð¡ÊýλÊýºÍ³¤¶È¡£
SQL Server Ϊ SQL-92 ¼æÈÝÐÔÌṩÁËÊý¾ÝÀàÐÍͬÒå´Ê¡£Óйظü¶àÐÅÏ¢£¬Çë²Î¼ûÊý¾ÝÀàÐÍͬÒå´Ê¡£
¾«È·Êý×Ö
ÕûÊý
bigint ´Ó -2^63 (-9223372036854775808) µ½ 2^63-1 (9223372036854775807) µÄÕûÐÍÊý¾Ý£¨ËùÓÐÊý×Ö£©¡£
int ´Ó -2^31 (-2,147,483,648) µ½ 2^31 - 1 (2,147,483,647) µÄÕûÐÍÊý¾Ý£¨ËùÓÐÊý×Ö£©¡£
smallint ´Ó -2^15 (-32,768) µ½ 2^15 - 1 (32,767) µÄÕûÊýÊý¾Ý¡£
tinyint ´Ó 0 µ½ 255 µÄÕûÊýÊý¾Ý¡£
bit
bit 1 »ò 0 µÄÕûÊýÊý¾Ý¡£
decimal ºÍ numeric
decimal ´Ó -10^38 +1 µ½ 10^38 –1 µÄ¹Ì¶¨¾«¶ÈºÍСÊýλµÄÊý×ÖÊý¾Ý¡£
numeric ¹¦ÄÜÉϵÈͬÓÚ decimal¡£
money ºÍ smallmoney
money »õ±ÒÊý¾ÝÖµ½éÓÚ -2^63 (-922,337,203,685,477.5808) Óë 2^63 -1 (+922,337,203,685,477.5807) Ö®¼ä£¬¾«È·µ½»õ±Òµ¥Î»µÄǧ·Ö֮ʮ¡£
smallmoney »õ±ÒÊý¾ÝÖµ½éÓÚ -214,748.3648 Óë +214,748.3647 Ö®¼ä£¬¾«È·µ½»õ±Òµ¥Î»µÄǧ·Ö֮ʮ¡£
½üËÆÊý×Ö
float ´Ó -1.79E + 308 µ½ 1.79E + 308 µÄ¸¡µã¾«¶ÈÊý×Ö¡£
real ´Ó -3.40E + 38 µ½ 3.40E + 38 µÄ¸¡µã¾«¶ÈÊý×Ö¡£
datetime ºÍ smalldatetime
datetime ´Ó 1753 Äê 1 Ô 1 ÈÕµ½ 9999 Äê 12 Ô 31 ÈÕµÄÈÕÆÚºÍʱ¼äÊý¾Ý£¬¾«È·µ½°Ù·ÖÖ®ÈýÃ루»ò 3.33 ºÁÃ룩¡£
smalldatetime ´Ó 1900 Äê 1 Ô 1 ÈÕµ½ 2079 Äê 6 Ô 6 ÈÕµÄÈÕÆÚºÍʱ¼äÊý¾Ý£¬¾«È·µ½·ÖÖÓ¡£
×Ö·û´®
char ¹Ì¶¨³¤¶ÈµÄ·Ç Unicode ×Ö·ûÊý¾Ý£¬×î´ó³¤¶ÈΪ 8,000 ¸ö×Ö·û¡£
varchar ¿É±ä³¤¶ÈµÄ·Ç Unicode Êý¾Ý£¬×Î
Ïà¹ØÎĵµ£º
MSSQLÈ«ÎļìË÷ --1.´ò¿ªÊý¾Ý¿â
use pubs
go
--2.´ò¿ªÈ«ÎÄË÷ÒýÖ§³Ö
--execute sp_fulltext_database 'enable'
/*
£¨ËùÓ°ÏìµÄÐÐÊýΪ 1 ÐУ©
£¨ËùÓ°ÏìµÄÐÐÊýΪ 0 ÐУ©
£¨ËùÓ°ÏìµÄÐÐÊýΪ 1 ÐУ©
*/ ......
ODBCÊý¾ÝÔ´¿É·ÖΪ“ϵͳÐÍ”ºÍ“ÎļþÐÍ”£¬ËûÃǵÄÇø±ðÔÚÓړϵͳÐÍ”ÊÇÁ¬½ÓÊý¾Ý¿âµÄÐÅÏ¢½¨Á¢Ôړϵͳע²á±í”À“ÎļþÐÍ”ÔòÊÇÒÔdsnÎļþÐÎʽ´æ´¢ÔÚODBCÔ´µÄĿ¼ÏÂÃæ
Ò»¡¢½¨Á¢ODBCÊý¾ÝÔ´µÄ·½·¨£º
¿ØÖÆÃæ°å - ¹ÜÀí¹¤¾ß - Êý¾ÝÔ´£¨ODBC£©
´ò¿ªODBCÊý¾ÝÔ´¹ÜÀíÆ÷£¬È»ºóÒ ......
xtype ´ú±íÀàÐÍ
C = CHECK Ô¼Êø
D = ĬÈÏÖµ»ò DEFAULT Ô¼Êø
F = FOREIGN KEY Ô¼Êø
L = ÈÕÖ¾
FN = ±êÁ¿º¯Êý
IF = ÄÚǶ±íº¯Êý
P = ´æ´¢¹ý³Ì
PK = PRIMARY KEY Ô¼Êø£¨ÀàÐÍÊÇ K£©
RF = ¸´ÖÆɸѡ´æ´¢¹ý³Ì
S = ϵͳ±í
TF = ±íº¯Êý
TR = ´¥· ......
sql´æ´¢¹ý³Ì½Ì³Ì
[ËѼ¯ÕûÀí]sql´æ´¢¹ý³ÌÍêÈ«½Ì³Ì
Ŀ¼
1.sql´æ´¢¹ý³Ì¸ÅÊö
2.SQL´æ´¢¹ý³Ì´´½¨
3.sql´æ´¢¹ý³Ì¼°Ó¦ÓÃ
4.¸÷ÖÖ´æ´¢¹ý³ÌʹÓÃÖ¸ÄÏ
5.ASPÖд洢¹ý³Ìµ÷ÓõÄÁ½ÖÖ·½Ê½¼°±È½Ï
6.SQL´æ´¢¹ý³ÌÔÚ.NETÊý¾Ý¿âÖеÄÓ¦ÓÃ
7.ʹÓÃSQL´æ´¢¹ý³ÌÒªÌرð×¢ÒâµÄÎÊÌâ
1.sql´æ´¢¹ý³Ì¸ÅÊö
ÔÚ´óÐÍÊý¾Ý¿âϵͳÖУ¬´æ´ ......
Ms sql 2000
drivername=com.microsoft.jdbc.sqlserver.SQLServerDriver
url=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=books
username=sa
password=sa
MySQL
drivername=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost/books
username=root
password=root
Oracle
drivername=orac ......