1 exec sp_executesql N'SELECT 2 [Extent2].[Id] AS [Id], 3 [Extent2].[Name] AS [Name], 4 [Extent2].[Description] AS [Description], 5 [Extent2].[RoleTypeNum] AS [RoleTypeNum], 6 [Extent2].[IsDeleted] AS [IsDeleted], 7 [Extent2].[AddDate] AS [AddDate], 8 [Extent2].[Timestamp] AS [Timestamp] 9 FROM [dbo].[RoleMembers] AS [Extent1] 10 INNER JOIN [dbo].[Roles] AS [Extent2] ON [Extent1].[Role_Id] = [Extent2].[Id] 11 WHERE [Extent1].[Member_Id] = @EntityKeyValue1',N'@EntityKeyValue1 int',@EntityKeyValue1=1
去掉小数点后的0
ALTER function [dbo].[GetNumber](@str nvarchar(200))
returns nvarchar(200)
as
begin
declare @num int
declare @s nvarchar(200)
set @num = 0
if(charindex('.',@str,0) <> 0) --判断是否有.
begin
while(@num<1)
begin
if(substring(@str,len(@str),1) = '0') --最后一位是0时,去掉最后一位
begin
set @str = left(@str,LEN(@str)-1) --删除最后一位字符
end
else if(substring(@str,len(@str),1) = '.') --最后一位是.时,去掉最后一位
begin
set @str = left(@str,LEN(@str)-1) --删除最后一位字符
set @num = 1 --给变量赋值(不满足循环条件,循环结束)
end
else
begin
set @num = 1 --给变量赋值(不满足循环条件,循环结束)
end
end
end
set @s = @str
return @s
end