|
|
-
Anthony Faull Commented 7 Months ago through Blogs
You can remove leading zeros using PATINDEX, LEFT and RIGHT. The ISNULL and NULLIF are to handle the case when all digits are zero.
CASE WHEN LEFT(Data, 1) = '0'
THEN RIGHT(Data, LEN(Data) - ISNULL(NULLIF(PATINDEX('%[^0]%', Data), 0), LE...
|
-
Anthony Faull Liked 1 Years ago through Pages
We wish to use these pages for publishing various documents, announcements, FAQ etc related to beyondrelational.com...
|
-
Anthony Faull Commented 1 Years ago through Blogs
Here's another way to sum the digits of a 32-bit signed integer.
CREATE FUNCTION SumOfDigits(@N int)
RETURNS int AS BEGIN RETURN
(
SELECT ABS(@N) % 10
+ ABS(@N) / CAST(1E1 AS int) % 10
+ ABS(@N) / CAST(1E2 AS ...
|
-
Anthony Faull Commented 1 Years ago through Puzzles
This solution uses PIVOT and UNPIVOT, subqueries, CROSS APPLY, ROW_NUMBER, modulo arithmetic, ASCII, XQuery, and REPLACE.
|
-
Anthony Faull Solved 1 Years ago through Puzzles
This solution uses PIVOT and UNPIVOT, subqueries, CROSS APPLY, ROW_NUMBER, modulo arithmetic, ASCII, XQuery, and REPLACE.
|
-
Anthony Faull Solved 1 Years ago through Puzzles
This code uses a recursive common table expression (CTE) and a ranking function. The anchor member ranks the episodes for each dated item. The recursive member appends the undated items until the maximum sequence number is reached. The MAXRECURSION option
|
-
Anthony Faull Commented 1 Years ago through Puzzles
This code uses a recursive common table expression (CTE) and a ranking function. The anchor member ranks the episodes for each dated item. The recursive member appends the undated items until the maximum sequence number is reached. The MAXRECURSION option
|
-
Anthony Faull Solved 1 Years ago through Puzzles
This code uses a recursive common table expression (CTE) and a ranking function. The anchor member ranks the episodes for each dated item. The recursive member appends the undated items until the maximum sequence number is reached. The MAXRECURSION option
|