sql ϵͳº¯Êý
1.×Ö·û´®º¯Êý
³¤¶ÈÓë·ÖÎöÓÃ
datalength(Char_expr) ·µ»Ø×Ö·û´®°üº¬×Ö·ûÊý,µ«²»°üº¬ºóÃæµÄ¿Õ¸ñ
substring(expression,start,length) ²»¶à˵ÁË,È¡×Ó´®
right(char_expr,int_expr) ·µ»Ø×Ö·û´®ÓÒ±ßint_expr¸ö×Ö·û
×Ö·û²Ù×÷Àà
upper(char_expr) תΪ´óд
lower(char_expr) תΪСд
space(int_expr) Éú³Éint_expr¸ö¿Õ¸ñ
replicate(char_expr,int_expr)¸´ÖÆ×Ö·û´®int_expr´Î
reverse(char_expr) ·´×ª×Ö·û´®
stuff(char_expr1,start,length,char_expr2) ½«×Ö·û´®char_expr1ÖеĴÓ
start¿ªÊ¼µÄlength¸ö×Ö·ûÓÃchar_expr2´úÌæ
ltrim(char_expr) rtrim(char_expr) È¡µô¿Õ¸ñ
ascii(char) char(ascii) Á½º¯Êý¶ÔÓ¦,È¡asciiÂë,¸ù¾ÝasciiÂðÈ¡×Ö·û
×Ö·û´®²éÕÒ
charindex(char_expr,expression) ·µ»Øchar_exprµÄÆðʼλÖÃ
patindex("%pattern%",expression) ·µ»ØÖ¸¶¨Ä£Ê½µÄÆðʼλÖÃ,·ñÔòΪ0
abs(numeric_expr) Çó¾ø¶ÔÖµ
ceiling(numeric_expr) È¡´óÓÚµÈÓÚÖ¸¶¨ÖµµÄ×îСÕûÊý
exp(float_expr) È¡Ö¸Êý
floor(numeric_expr) СÓÚµÈÓÚÖ¸¶¨ÖµµÃ×î´óÕûÊý
pi() 3.1415926.........
power(numeric_expr,power) ·µ»Øpower´Î·½
rand([int_expr]) Ëæ»úÊý²úÉúÆ÷
round(numeric_expr,int_expr) °²int_expr¹æ¶¨µÄ¾«¶ÈËÄÉáÎåÈë
sign(int_expr) ¸ù¾ÝÕýÊý,0,¸ºÊý,,·µ»Ø+1,0,-1
sqrt(float_expr) ƽ·½¸ù
2.ÈÕÆÚº¯Êý
getdate() ·µ»ØÈÕÆÚ
datename(datepart,date_expr) ·µ»ØÃû³ÆÈç June
datepart(datepart,date_expr) È¡ÈÕÆÚÒ»²¿·Ý
datediff(datepart,date_expr1.dateexpr2) ÈÕÆÚ²î
dateadd(datepart,number,date_expr) ·µ»ØÈÕÆÚ¼ÓÉÏ number
ÉÏÊöº¯ÊýÖÐdatepartµÄ
д·¨ È¡ÖµºÍÒâÒå
yy 1753-9999 Äê·Ý
qq 1-4 ¿Ì
mm 1-12 ÔÂ
dy 1-366 ÈÕ
dd 1-31 ÈÕ
wk 1-54 ÖÜ
dw 1-7 Öܼ¸ 
Ïà¹ØÎĵµ£º
±¾ÎÄÕë¶ÔSQL*Loader¿ØÖÆÎļþ½øÐÐ˵Ã÷¡£
Ò»£ºSQL*Loader¿ØÖÆÎļþµÄÄÚÈÝ
SQL*Loader¿ØÖÆÎļþʹÓÃDDLÃüÁîÀ´¿ØÖÆSQL*Loader»á»°µÄÒÔÏÂÏîÄ¿£º
¡ñʹÓÃSQL*Loaderµ¼ÈëÊý¾ÝµÄλÖÃ
¡ñÊý¾Ý¸ñʽÉ趨·½·¨
¡ñµ¼ÈëÊý¾ÝʱSQL*LoaderµÄÉ趨¡££¨ÄÚ´æ¹ÜÀí¡¢±»¾Ü¾ø¼Ç¼¡¢µ¼Èë´¦ÀíµÄÖжϵȣ©
¡ñµ¼ÈëʱÊý¾ÝµÄ´¦Àí·½·¨
¿ØÖÆÎļþÀý£ºemp.ctl ......
SQL SERVER 2008 Òì²½²¶»ñ±íÊý¾ÝÐÞ¸Ä
дµÄ²»¶ÔµÄµØ·½Çë¸÷λָÕý£¬Ð´µÄÒ²±È½ÏÂÒ¡£½²¾¿Õâ¿´°É¡£^ ^
/*
SQL SERVER 2008 Òì²½²¶»ñ±íÊý¾ÝÐÞ¸Ä
SQL server 2008ΪÒì²½¸ú×ÙËùÓз¢ÉúÔÚÓû§±íÉϵÄÊý¾ÝÐÞ¸ÄÌṩÁËÄÚ½¨µÄ·½·¨,
¶ø²»ÐèÒª±àд×Ô¶¨ÒåµÄ´¥·¢Æ÷»òÕß²éѯ,±ä¸üÊý¾Ý²¶»ñÓµÓÐ×îСÐÔÄÜ¿ªÏú,¿ÉÒÔ
Ó ......
ÔÚSQL Server 2008ÖÐÒýÈëÁËhierarchyidÀ´´¦ÀíÊ÷×´½á¹¹¡£ÏÂÃæ¼òµ¥¾ÍÒÔAdventureWorks(ÎÞhierarchyid)ºÍAdventureWorks2008(ÓÐhierarchyid)ÀïµÄHumanResources.EmployeeΪÀý£¬À´ËµÃ÷Ò»ÏÂÔÚеÄhierarchyidÖÐÈçºÎ½øÐÐflat»¯µÄdimension³éÈ¡¡£
AdventureWorksÊÇ΢ÈíΪSQL ServerÌṩµÄÊý¾Ý¿âÐéÄâ°¸Àý¡£
AdventureWorksÖÐËùÒªµ ......
±¾ÎÄÀ´×Ô£ºhttp://hi.baidu.com/darkroot/blog/item/7b74be2cf06d76e78b139903.html
declare @tbName nvarchar(500)
declare @ct int
declare @csql nvarchar(500)
declare &n ......
ÎÒÃÇÖªµÀ£¬ÔÚSQL SERVERÖÐÓÐBit, Float, Int , CharµÈµÈһϵÁеÄÊý¾ÝÀàÐÍ£¬¶øÔÚDOT NETÖУ¬ÓÐBoolean,Double,Int 32,StringµÈÊý¾ÝÀàÐÍÓëÖ®¶ÔÓ¦¡£ Ò²¾ÍÊÇ˵£¬Êý¾Ý¿âÖеÄÊý¾ÝÀàÐÍÓëDOT NETµÄÊý¾ÝÀàÐÍÖ®¼ä£¬ÓÐÒ»¸öÓ³Éä¹Øϵ¡£Ï±íÊÇËûÃǵÄÓ³Éä¹Øϵ£º
dot netÖеÄÊý¾ÝÀàÐÍ &n ......