要想知道字符是否为MS SQL Server保留字,那我们必须把SQL所有保留字放在一个数据集中。然后我们才能判断所查找的字符是否被包含在数据集中。

MS SQL Server保留字:

DECLARE @ReservedWords VARCHAR(2000) = 'add,all,alter,and,any,as,asc,authorization,avg,backup,begin,between,break,browse,bulk,by,cascade,case,check,checkpoint,close,clustered,coalesce,column,commit,committed,compute,confirm,constraint,contains,containstable,continue,controlrow,convert,count,create,cross,current,current_date,current_time,current_timestamp,current_user,cursor,database,dbcc,deallocate,declare,default,delete,deny,desc,disk,distinct,distributed,double,drop,dummy,dump,else,end,errlvl,errorexit,escape,except,exec,execute,exists,exit,fetch,file,fillfactor,floppy,for,foreign,freetext,freetexttable,from,full,goto,grant,group,having,holdlock,identity,identity_insert,identitycol,if,in,index,inner,insert,intersect,into,is,isolation,join,key,kill,left,level,like,lineno,load,max,min,mirrorexit,national,nocheck,nonclustered,not,null,nullif,of,off,offsets,on,once,only,open,opendatasource,openquery,openrowset,option,or,order,outer,over,percent,percision,perm,permanent,pipe,plan,prepare,primary,print,privileges,proc,procedure,processexit,public,raiserror,read,readtext,reconfigure,references,repeatable,replication,restore,restrict,return,revoke,right,rollback,rowcount,rowguidcol,rule,save,schema,select,serializable,session_user,set,setuser,shutdown,some,statistics,sum,system_user,table,tape,temp,temporary,textsize,then,to,top,tran,transaction,trigger,truncate,tsequal,uncommitted,union,unique,update,updatetext,use,user,values,varying,view,waitfor,when,where,while,with,work,writetext,'

 

此时,我们可以把这字符串拆分插入一张表中:

字符是否为SQL的保留字

 

CREATE TABLE [dbo].[ReservedWordOfSql]
(
    [KeyWork] NVARCHAR(40)
)
GO
Source Code

相关文章:

  • 2022-01-24
  • 2021-12-04
  • 2021-09-10
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
猜你喜欢
  • 2021-07-27
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
相关资源
相似解决方案