SQL Server 的保留關(guān)鍵字一覽
2024-08-31 00:48:29
供稿:網(wǎng)友
 
sql server 保留關(guān)鍵字
microsoft® sql server™ 2000 使用保留關(guān)鍵字定義、操作和訪問數(shù)據(jù)庫。保留關(guān)鍵字是 sql server 使用的 transact-sql 語言語法的一部分,用于分析和理解 transact-sql 語句和批處理。盡管在 transact-sql 腳本中,使用 sql server 保留關(guān)鍵字作為標(biāo)識符和對象名在語法上是可行的,但規(guī)定只能使用分隔標(biāo)識符。
下表列出了 sql server 的保留關(guān)鍵字。
addexceptpercentallexecplanalterexecuteprecisionandexistsprimaryanyexitprintasfetchprocascfileprocedureauthorizationfillfactorpublicbackupforraiserrorbeginforeignreadbetweenfreetextreadtextbreakfreetexttablereconfigurebrowsefromreferencesbulkfullreplicationbyfunctionrestorecascadegotorestrictcasegrantreturncheckgrouprevokecheckpointhavingrightcloseholdlockrollbackclusteredidentityrowcountcoalesceidentity_insertrowguidcolcollateidentitycolrulecolumnifsavecommitinschemacomputeindexselectconstraintinnersession_usercontainsinsertsetcontainstableintersectsetusercontinueintoshutdownconvertissomecreatejoinstatisticscrosskeysystem_usercurrentkilltablecurrent_datelefttextsizecurrent_timelikethencurrent_timestamplinenotocurrent_userloadtopcursornationaltrandatabasenochecktransactiondbccnonclusteredtriggerdeallocatenottruncatedeclarenulltsequaldefaultnullifuniondeleteofuniquedenyoffupdatedescoffsetsupdatetextdiskonusedistinctopenuserdistributedopendatasourcevaluesdoubleopenqueryvaryingdropopenrowsetviewdummyopenxmlwaitfordumpoptionwhenelseorwhereendorderwhileerrlvlouterwithescapeoverwritetext
另外,sql-92 標(biāo)準(zhǔn)還定義了保留關(guān)鍵字列表。不要使用 sql-92 保留關(guān)鍵字作為對象名和標(biāo)識符。odbc 保留關(guān)鍵字列表(如下所示)與 sql-92 保留關(guān)鍵字列表相同。
說明  sql-92 保留關(guān)鍵字列表有時可能比 sql server 限制更多,有時則限制更少。例如,sql-92 保留關(guān)鍵字列表包含 int,而 sql server 不需要將其區(qū)分為保留關(guān)鍵字。
transact-sql 保留關(guān)鍵字可用作數(shù)據(jù)庫或數(shù)據(jù)庫對象(如表、列、視圖等)的標(biāo)識符或名稱。使用被引用的標(biāo)識符或分隔標(biāo)識符。對將保留關(guān)鍵字用作變量和存儲過程參數(shù)的名稱沒有限制。
odbc 保留關(guān)鍵字
保留了下列關(guān)鍵字用于 odbc 函數(shù)調(diào)用。這些關(guān)鍵字根本不約束 sql 語法;然而,為確保與支持核心 sql 語法的驅(qū)動程序兼容,應(yīng)用程序應(yīng)避免使用這些關(guān)鍵字。
下面是當(dāng)前的 odbc 保留關(guān)鍵字列表。有關(guān)更多信息,請參見《microsoft odbc 3.0 程序員參考》,第 2 卷,附錄 c。
absoluteexecoverlapsactionexecutepadadaexistspartialaddexternalpascalallextractpositionallocatefalseprecisionalterfetchprepareandfirstpreserveanyfloatprimaryareforpriorasforeignprivilegesascfortranprocedureassertionfoundpublicatfromreadauthorizationfullrealavggetreferencesbeginglobalrelativebetweengorestrictbitgotorevokebit_lengthgrantrightbothgrouprollbackbyhavingrowscascadehourschemacascadedidentityscrollcaseimmediatesecondcastinsectioncatalogincludeselectcharindexsessionchar_lengthindicatorsession_usercharacterinitiallysetcharacter_lengthinnersizecheckinputsmallintcloseinsensitivesomecoalesceinsertspacecollateintsqlcollationintegersqlcacolumnintersectsqlcodecommitintervalsqlerrorconnectintosqlstateconnectionissqlwarningconstraintisolationsubstringconstraintsjoinsumcontinuekeysystem_userconvertlanguagetablecorrespondinglasttemporarycountleadingthencreatelefttimecrossleveltimestampcurrentliketimezone_hourcurrent_datelocaltimezone_minutecurrent_timelowertocurrent_timestampmatchtrailingcurrent_usermaxtransactioncursormintranslatedateminutetranslationdaymoduletrimdeallocatemonthtruedecnamesuniondecimalnationaluniquedeclarenaturalunknowndefaultncharupdatedeferrablenextupperdeferrednousagedeletenoneuserdescnotusingdescribenullvaluedescriptornullifvaluesdiagnosticsnumericvarchardisconnectoctet_lengthvaryingdistinctofviewdomainonwhendoubleonlywheneverdropopenwhereelseoptionwithendorworkend-execorderwriteescapeouteryearexceptoutputzoneexception  
將來的關(guān)鍵字
以下關(guān)鍵字可能會保留在將來的 sql server 版本中,作為將來要實現(xiàn)的新特性。注意,不要使用這些關(guān)鍵字作為標(biāo)識符。
absolutefoundpreserveactionfreeprioradmingeneralprivilegesaftergetreadsaggregateglobalrealaliasgorecursiveallocategroupingrefarehostreferencingarrayhourrelativeassertionignoreresultatimmediatereturnsbeforeindicatorrolebinaryinitializerollupbitinitiallyroutineblobinoutrowbooleaninputrowsbothintsavepointbreadthintegerscrollcallintervalscopecascadedisolationsearchcastiteratesecondcataloglanguagesectioncharlargesequencecharacterlastsessionclasslateralsetsclobleadingsizecollationlesssmallintcompletionlevelspaceconnectlimitspecificconnectionlocalspecifictypeconstraintslocaltimesqlconstructorlocaltimestampsqlexceptioncorrespondinglocatorsqlstatecubemapsqlwarningcurrent_pathmatchstartcurrent_roleminutestatecyclemodifiesstatementdatamodifystaticdatemodulestructuredaymonthtemporarydecnamesterminatedecimalnaturalthandeferrablenchartimedeferrednclobtimestampdepthnewtimezone_hourderefnexttimezone_minutedescribenotrailingdescriptornonetranslationdestroynumerictreatdestructorobjecttruedeterministicoldunderdictionaryonlyunknowndiagnosticsoperationunnestdisconnectordinalityusagedomainoutusingdynamicoutputvalueeachpadvarcharend-execparametervariableequalsparameterswhenevereverypartialwithoutexceptionpathworkexternalpostfixwriteflaseprefixyearfirstpreorderzonefloatprepare