SQL命令大全-中英文對照第3/3頁
更新時間:2007年11月22日 22:36:10 作者:
QUOTENAME() --函數(shù)返回被特定字符括起來的字符串
/*select quotename('abc', '{') quotename('abc')
運(yùn)行結(jié)果如下
----------------------------------{
{abc} [abc]*/
REPLICATE() --函數(shù)返回一個重復(fù)character_expression 指定次數(shù)的字符串
/*select replicate('abc', 3) replicate( 'abc', -2)
運(yùn)行結(jié)果如下
----------- -----------
abcabcabc NULL*/
REVERSE() --函數(shù)將指定的字符串的字符排列順序顛倒
REPLACE() --函數(shù)返回被替換了指定子串的字符串
/*select replace('abc123g', '123', 'def')
運(yùn)行結(jié)果如下
----------- -----------
abcdefg*/
SPACE() --函數(shù)返回一個有指定長度的空白字符串
STUFF() --函數(shù)用另一子串替換字符串指定位置長度的子串
----數(shù)據(jù)類型轉(zhuǎn)換函數(shù)----
CAST() 函數(shù)語法如下
CAST() (<expression> AS <data_ type>[ length ])
CONVERT() 函數(shù)語法如下
CONVERT() (<data_ type>[ length ], <expression> [, style])
select cast(100+99 as char) convert(varchar(12), getdate())
運(yùn)行結(jié)果如下
------------------------------ ------------
199 Jan 15 2000
----日期函數(shù)----
DAY() --函數(shù)返回date_expression 中的日期值
MONTH() --函數(shù)返回date_expression 中的月份值
YEAR() --函數(shù)返回date_expression 中的年份值
DATEADD(<datepart> ,<number> ,<date>)
--函數(shù)返回指定日期date 加上指定的額外日期間隔number 產(chǎn)生的新日期
DATEDIFF(<datepart> ,<number> ,<date>)
--函數(shù)返回兩個指定日期在datepart 方面的不同之處
DATENAME(<datepart> , <date>) --函數(shù)以字符串的形式返回日期的指定部分
DATEPART(<datepart> , <date>) --函數(shù)以整數(shù)值的形式返回日期的指定部分
GETDATE() --函數(shù)以DATETIME 的缺省格式返回系統(tǒng)當(dāng)前的日期和時間
----系統(tǒng)函數(shù)----
APP_NAME() --函數(shù)返回當(dāng)前執(zhí)行的應(yīng)用程序的名稱
COALESCE() --函數(shù)返回眾多表達(dá)式中第一個非NULL 表達(dá)式的值
COL_LENGTH(<'table_name'>, <'column_name'>) --函數(shù)返回表中指定字段的長度值
COL_NAME(<table_id>, <column_id>) --函數(shù)返回表中指定字段的名稱即列名
DATALENGTH() --函數(shù)返回?cái)?shù)據(jù)表達(dá)式的數(shù)據(jù)的實(shí)際長度
DB_ID(['database_name']) --函數(shù)返回?cái)?shù)據(jù)庫的編號
DB_NAME(database_id) --函數(shù)返回?cái)?shù)據(jù)庫的名稱
HOST_ID() --函數(shù)返回服務(wù)器端計(jì)算機(jī)的名稱
HOST_NAME() --函數(shù)返回服務(wù)器端計(jì)算機(jī)的名稱
IDENTITY(<data_type>[, seed increment]) [AS column_name])
--IDENTITY() 函數(shù)只在SELECT INTO 語句中使用用于插入一個identity column列到新表中
/*select identity(int, 1, 1) as column_name
into newtable
from oldtable*/
ISDATE() --函數(shù)判斷所給定的表達(dá)式是否為合理日期
ISNULL(<check_expression>, <replacement_value>) --函數(shù)將表達(dá)式中的NULL 值用指定值替換
ISNUMERIC() --函數(shù)判斷所給定的表達(dá)式是否為合理的數(shù)值
NEWID() --函數(shù)返回一個UNIQUEIDENTIFIER 類型的數(shù)值
NULLIF(<expression1>, <expression2>)
--NULLIF 函數(shù)在expression1 與expression2 相等時返回NULL 值若不相等時則返回expression1 的值
--------------------------------------------------------------------------------
sql中的保留字
action add aggregate all
alter after and as
asc avg avg_row_length auto_increment
between bigint bit binary
blob bool both by
cascade case char character
change check checksum column
columns comment constraint create
cross current_date current_time current_timestamp
data database databases date
datetime day day_hour day_minute
day_second dayofmonth dayofweek dayofyear
dec decimal default delayed
delay_key_write delete desc describe
distinct distinctrow double drop
end else escape escaped
enclosed enum explain exists
fields file first float
float4 float8 flush foreign
from for full function
global grant grants group
having heap high_priority hour
hour_minute hour_second hosts identified
ignore in index infile
inner insert insert_id int
integer interval int1 int2
int3 int4 int8 into
if is isam join
key keys kill last_insert_id
leading left length like
lines limit load local
lock logs long longblob
longtext low_priority max max_rows
match mediumblob mediumtext mediumint
middleint min_rows minute minute_second
modify month monthname myisam
natural numeric no not
null on optimize option
optionally or order outer
outfile pack_keys partial password
precision primary procedure process
processlist privileges read real
references reload regexp rename
replace restrict returns revoke
rlike row rows second
select set show shutdown
smallint soname sql_big_tables sql_big_selects
sql_low_priority_updates sql_log_off sql_log_update sql_select_limit
sql_small_result sql_big_result sql_warnings straight_join
starting status string table
tables temporary terminated text
then time timestamp tinyblob
tinytext tinyint trailing to
type use using unique
unlock unsigned update usage
values varchar variables varying
varbinary with write when
where year year_month zerofill
相關(guān)文章
SQLServer 數(shù)據(jù)庫變成單個用戶后無法訪問問題的解決方法
今天不知怎么點(diǎn)錯了東西,SQLServer中的一個數(shù)據(jù)庫變成單用戶了,而且無法訪問,下面是解決方法,有需要的朋友可以參考一下2013-10-10
對有insert觸發(fā)器表取IDENTITY值時發(fā)現(xiàn)的問題
趕快查了下msdn,原來@@IDENTITY還有這么多講究2009-06-06
sqlserver數(shù)據(jù)庫規(guī)模膨脹太大怎么優(yōu)化
數(shù)據(jù)庫規(guī)模膨脹是SQLServer數(shù)據(jù)庫運(yùn)維中常見的問題之一,本文介紹了一些緩解膨脹問題的方法,包括增加內(nèi)存、數(shù)據(jù)壓縮、數(shù)據(jù)庫分區(qū)等,在實(shí)踐過程中,應(yīng)根據(jù)具體情況,采取適當(dāng)?shù)姆椒?以達(dá)到最優(yōu)的緩解膨脹問題的效果2024-02-02

