Advertisement
WorkAkkaunt

GetPersentFunction

Aug 5th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.42 KB | None | 0 0
  1. USE [oktell]
  2. GO
  3. /****** Object:  UserDefinedFunction [dbo].[GetTimeFromSecond]    Script Date: 05.08.2019 9:12:11 ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8.  
  9. ALTER FUNCTION [dbo].[GetPersent] (@param1 int, @param2 int)
  10. RETURNS varchar(10) AS
  11. BEGIN
  12.     RETURN IIF
  13.         (
  14.             @param2 != 0 AND @param2 IS NOT NULL
  15.             , CAST(ROUND(CAST(@param1 as float) / @param2, 4) * 100 as nvarchar(10)) + '%'
  16.             , '0%'
  17.         )
  18. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement