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="Create TABLE [±íÃû]"
¶þ¡¢´´½¨Ò»ÕÅÓÐ×Ö¶ÎµÄ±í£º
Sql="Create TABLE [±íÃû]([×Ö¶ÎÃû1] MEMO NOT NULL, [×Ö¶ÎÃû2] MEMO, [×Ö¶ÎÃû3] COUNTER NOT NULL, [×Ö¶ÎÃû4] DATETIME, [×Ö¶ÎÃû5] TEXT(200), [×Ö¶ÎÃû6] TEXT(200))
×Ö¶ÎÀàÐÍ£º
2 : "SmallInt", // ÕûÐÍ
3 : "Int", ......
1¡£ÆóÒµ¹ÜÀíÆ÷
´ò¿ªÄ㽨ÓÐÍâ¼üµÄ±í££ÓÒ»÷±í££Éè¼Æ±í££ÔÚÉÏ·½µã¿ª’¹ÜÀíÔ¼Êø‘££½«¼¶Á¬É¾³ýºÍ¼¶Á¬¸üÐµĹµ´òÉϾͿÉÒÔÁË
2¡£²éѯ·ÖÎöÆ÷
alter table sc
add
constraint forei ......
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
impo ......
select upper(name) from syscolumns
where id =any
(
select Id from sysobjects where name='tb_city'
)
lower
select row_number() over(order by firmid) from dbo.tb_BuildingMaterial
Éú³É ×ÔÔö 123
select rank() over(order by firmid) from dbo.tb_BuildingMaterial
Éú³É×ÔÔö123 ¸ù¾ÝÅ ......