if exists ( select * from sys.objects where object_id = object_id(N'dbo.a_NoNum') and type in (N'FN', N'if', N'TF', N'FS', N'FT') ) drop function dbo.a_NoNum go
create function dbo.a_NoNum ( @Txt varchar(max) ) returns varchar(max) as begin --------------------------------------------------------------------------------------------------------------------------------------------- set @Txt = replace( @Txt ,'.' ,'')
set @Txt = replace( @Txt ,'1' ,'') set @Txt = replace( @Txt ,'2' ,'') set @Txt = replace( @Txt ,'3' ,'') set @Txt = replace( @Txt ,'4' ,'') set @Txt = replace( @Txt ,'5' ,'') set @Txt = replace( @Txt ,'6' ,'') set @Txt = replace( @Txt ,'7' ,'') set @Txt = replace( @Txt ,'8' ,'') set @Txt = replace( @Txt ,'9' ,'') set @Txt = replace( @Txt ,'0' ,'') --------------------------------------------------------------------------------------------------------------------------------------------- return @Txt end
if exists ( select * from sys.objects where object_id = object_id(N'dbo.a_NoNum') and type in (N'FN', N'if', N'TF', N'FS', N'FT') ) drop function dbo.a_NoNum go
create function dbo.a_NoNum ( @Txt varchar(max) ) returns varchar(max) as begin --------------------------------------------------------------------------------------------------------------------------------------------- set @Txt = replace( @Txt ,'.' ,'')
set @Txt = replace( @Txt ,'1' ,'') set @Txt = replace( @Txt ,'2' ,'') set @Txt = replace( @Txt ,'3' ,'') set @Txt = replace( @Txt ,'4' ,'') set @Txt = replace( @Txt ,'5' ,'') set @Txt = replace( @Txt ,'6' ,'') set @Txt = replace( @Txt ,'7' ,'') set @Txt = replace( @Txt ,'8' ,'') set @Txt = replace( @Txt ,'9' ,'') set @Txt = replace( @Txt ,'0' ,'') --------------------------------------------------------------------------------------------------------------------------------------------- return @Txt end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */ go郭少锋创建 2023-10-19 18:35:02SQLSQL : Sql 文本按数字排序SQL : Sql 文本按数字排序select id ,name from student order by right( '0000000000000000000000000000000000000000'+ name ,40) -- name 前加 40个 0 ,截取后面 40个字郭少锋创建 2023-10-19 16:24:57SQLSQL : Sql 读取 xml 按钮权限SQL : Sql 读取 xml 按钮权限 SELECT a.value('(Operation)[1]','varchar(500)') AS Operation ,a.value('(OperationName)[1]','varchar(500)') AS OperationName ,a.value('(PermissionItemId)[1]','varchar(500)') AS PermissionItemId
FROM T_Meta_ObjectType CROSS APPLY FKernelXml.nodes('/FormMetadata/BusinessInfo/BusinessInfo/Elements/Form/FormOperations/FormOperation') as node(a)
where FID = 'aGsf_231017' --------------------------------------------------------------------------------------------------- -- 结果
SELECT node.c1.value('(@id)[1]','VARCHAR(50)') AS [id] ,node.c1.value('(Exception/@type)[1]','VARCHAR(50)') AS [type1] ,node.c1.value('(Exception/Task/@address)[1]','VARCHAR(50)') AS [address1] ,node.c1.value('(Exception/Error)[1]','VARCHAR(max)') AS [Error1] ,node.c1.value('(Exception/Severity)[1]','VARCHAR(max)') AS [Severity1] ,node.c1.value('(Exception/@type)[2]','VARCHAR(50)') AS [type2] ,node.c1.value('(Exception/Task/@address)[2]','VARCHAR(50)') AS [address2] ,node.c1.value('(Exception/Error)[2]','VARCHAR(max)') AS [Error2] ,node.c1.value('(Exception/Severity)[2]','VARCHAR(max)') AS [Severity2]