sql server 2005 Êý¾ÝÀàÐÍ£¨²¿·Ö£©Ïêϸ˵Ã÷
ÔÚ¼ÆËã»úÖÐÊý¾ÝÓÐÁ½ÖÖÌØÕ÷£ºÀàÐͺͳ¤¶È¡£ËùνÊý¾ÝÀàÐ;ÍÊÇÒÔÊý¾ÝµÄ±íÏÖ·½Ê½ºÍ´æ´¢·½Ê½À´»®·ÖµÄÊý¾ÝµÄÖÖÀà¡£ÔÚSQL Server ÖÐÿ¸ö±äÁ¿¡¢²ÎÊý¡¢±í´ïʽµÈ¶¼ÓÐÊý¾ÝÀàÐÍ¡£ ÆäÖУ¬BIGINT¡¢ SQL_VARIANT ºÍTABLE ÊÇSQL Server 2000 ÖÐÐÂÔö¼ÓµÄ3 ÖÖÊý¾ÝÀàÐÍ.
Ò»¡¢ ÕûÊýÊý¾ÝÀàÐÍ
ÕûÊýÊý¾ÝÀàÐÍÊÇ×î³£ÓõÄÊý¾ÝÀàÐÍÖ®Ò»¡£
1¡¢INT £¨INTEGER£©
INT £¨»òINTEGER£©Êý¾ÝÀàÐÍ´æ´¢´Ó-2^31 £¨-2 £¬147 £¬483 £¬648£© µ½2^31-1 £¨2 £¬147 £¬483£¬647£© Ö®¼äµÄËùÓÐÕý¸ºÕûÊý¡£Ã¿¸öINT ÀàÐ͵ÄÊý¾Ý°´4 ¸ö×Ö½Ú´æ´¢£¬ÆäÖÐ1 λ±íʾÕûÊýÖµµÄÕý¸ººÅ£¬ÆäËü31 λ±íʾÕûÊýÖµµÄ³¤¶ÈºÍ´óС¡£
2¡¢SMALLINT
SMALLINT Êý¾ÝÀàÐÍ´æ´¢´Ó-2^15£¨ -32£¬ 768£© µ½2^15-1 £¨ 32 £¬767 £©Ö®¼äµÄËùÓÐÕý¸ºÕûÊý¡£Ã¿¸öSMALLINT ÀàÐ͵ÄÊý¾ÝÕ¼ÓÃ2 ¸ö×ֽڵĴ洢¿Õ¼ä£¬ÆäÖÐ1 λ±íʾÕûÊýÖµµÄÕý¸ººÅ£¬ÆäËü15 λ±íʾÕûÊýÖµµÄ³¤¶ÈºÍ´óС¡£
3¡¢TINYINT
TINYINTÊý¾ÝÀàÐÍ´æ´¢´Ó0 µ½255 Ö®¼äµÄËùÓÐÕýÕûÊý¡£Ã¿¸öTINYINTÀàÐ͵ÄÊý¾ÝÕ¼ÓÃ1 ¸ö×ֽڵĴ洢¿Õ¼ä¡£
4¡¢BIGINT
BIGINT Êý¾ÝÀàÐÍ´æ´¢´Ó-2^63 £¨-9 £¬223£¬ 372£¬ 036£¬ 854£¬ 775£¬ 807£© µ½2^63-1£¨ 9£¬ 223£¬ 372£¬ 036 £¬854 £¬775£¬ 807£© Ö®¼äµÄËùÓÐÕý¸ºÕûÊý¡£Ã¿¸öBIGINT ÀàÐ͵ÄÊý¾ÝÕ¼ÓÃ8¸ö×ֽڵĴ洢¿Õ¼ä¡£
¶þ¡¢ ¸¡µãÊý¾ÝÀàÐÍ
¸¡µãÊý¾ÝÀàÐÍÓÃÓڴ洢ʮ½øÖÆСÊý¡£¸¡µãÊýÖµµÄÊý¾ÝÔÚSQL Server ÖвÉÓÃÉÏÉáÈ루Round up »ò³ÆΪֻÈë²»Éᣩ·½Ê½½øÐд洢¡£ËùνÉÏÉáÈëÊÇÖ¸£¬µ±£¨ÇÒ½öµ±£©ÒªÉáÈëµÄÊýÊÇÒ»¸ö·ÇÁãÊýʱ£¬¶ÔÆä±£ÁôÊý×Ö²¿·ÖµÄ×îµÍÓÐЧλÉϵÄÊýÖµ¼Ó1 £¬²¢½øÐбØÒªµÄ½øλ¡£ÈôÒ»¸öÊýÊÇÉÏÉáÈëÊý£¬Æä¾ø¶ÔÖµ²»»á¼õÉÙ¡£È磺¶Ô3.14159265358979 ·Ö±ð½øÐÐ2 λºÍ12λÉáÈ룬½á¹ûΪ3.15 ºÍ3.141592653590¡£
1¡¢REAL Êý¾ÝÀàÐÍ
REALÊý¾ÝÀàÐͿɾ«È·µ½µÚ7 λСÊý£¬Æ䷶ΧΪ´Ó-3.40E -38 µ½3.40E +38¡£ ÿ¸öREALÀàÐ͵ÄÊý¾ÝÕ¼ÓÃ4 ¸ö×ֽڵĴ洢¿Õ¼ä¡£
2¡¢FLOAT
FLOAT
Ïà¹ØÎĵµ£º
sql²éѯÖÐÏÔʾÐòºÅ
2009-06-04 09:27
/* ·½·¨Ò»*/
SELECTÐòºÅ= (SELECT COUNT(¿Í»§±àºÅ) from ¿Í»§ AS LiMing
WHERE LiMing.¿Í»§±àºÅ<= Chang.¿Í»§±àºÅ),
¿Í»§±àºÅ,¹«Ë¾Ãû³Æ
from¿Í»§ AS Chang ORDER BY 1;
G ......
SELECT EMP_ID,EMP_NO,LOGIN_NAME,EMP_NAME,SITE_CODE,DEPT_CODE,
JOB_DESC,HRMS_DEPT_CODE,MAIL_ACCOUNT,EXT_NO ,
(case when SITE_CODE='QCS' then 1 else 2 end) site
from dbo.AM_EMPLOYEE
WHERE ACTIVE = 'Y' AND EXT_NO = '6006'
order by site
ÏëÒªÔÚÔ±¹¤±íÖвé³öµç»°ºÅΪ6006µÄÔ±¹¤µÄÓ¢ÎÄÃûÀ´×÷ΪϵͳҳÃæÉ ......
Public Function GetDataTable()
Dim myComm As New SqlClient.SqlCommand("SELECT cauth_id,cauth_name,igrade,csupauth_id,csupauth_name from MAIN_TREE01 ", sqlconnection1)
Dim sdapt As New SqlClient.SqlDataAdapter(myComm)
Dim ds As New DataSet
sdapt.Fill(ds)
R ......
create PROC [dbo].[P_viewPage_A]
/*
¸ßЧͨÓ÷ÖÒ³´æ´¢¹ý³Ì(Ë«Ïò¼ìË÷)
¾´¸æ£ºÊÊÓÃÓÚµ¥Ò»Ö÷¼ü»ò´æÔÚΨһֵÁеıí»òÊÓͼ
ps:SqlÓï¾äΪ8000×Ö½Ú,µ÷ÓÃʱÇë×¢Òâ´«Èë²ÎÊý¼°sql×ܳ¤¶È²»Òª³¬¹ýÖ¸¶¨·¶Î§
*/
@TableName VARCHAR(200), --±íÃû
@FieldList VARCHAR(2000), --ÏÔʾÁÐà ......
¸üÐÂÏÂÎÊÌ⣺
񡜧TBL_Info
×ֶΣº
infoId int
title varchar(20)
Content text
byUser varchar(20)
createTime datetime
1¡¢ÈçºÎɾ³ý±íÖÐÊý¾ÝÏàͬµÄÊý¾ÝÄØ£¿£¨Ö÷¼ü³ýÍ⣩
2¡¢ÈçºÎɾ³ýÊý¾Ý±íÖÐij¸ö×Ö¶ÎÊý¾ÝÏàÍ ......