daily pastebin goal
60%
SHARE
TWEET

Untitled

a guest Jan 24th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ALTER FUNCTION WEEKDAYS(@DAY VARCHAR)
  2. RETURNS INT
  3. AS BEGIN
  4.     IF(@DAY IS NULL)
  5.     RETURN 0
  6.  
  7.         DECLARE @OUTPUT INT
  8.  
  9.         SELECT @OUTPUT=
  10.             CASE WHEN SUBSTRING(@DAY,1,1) = 'M' THEN 1
  11.                  WHEN SUBSTRING(@DAY,1,2) = 'TU' THEN 2
  12.                  WHEN SUBSTRING(@DAY,1,1) = 'W' THEN 3
  13.                  WHEN SUBSTRING(@DAY,1,2) = 'TH' THEN 4
  14.                  WHEN SUBSTRING(@DAY,1,1) = 'F' THEN 5
  15.                  WHEN SUBSTRING(@DAY,1,2) = 'SA' THEN 6
  16.                  WHEN SUBSTRING(@DAY,1,2) = 'SU' THEN 7
  17.             ELSE
  18.                 99 END
  19.         RETURN @OUTPUT
  20.     END
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top