Archive for the "Coding" Category

Oracle SQL – Date Range for ISO Week

Recently I had to work on a report for the marketing team. This report requires me to group the transactions by ISO week, and for the  very first time, i’m glad to be working on Oracle Database. In the report, I’ll need to display the date range for all the weeks, so after googling for [...]

C#: String Extensions – Jumble

Was bored so created a string extension in C# to jumble up a input string public static string Jumble(this string s) { if (!string.IsNullOrEmpty(s)) { ArrayList al = new ArrayList(); foreach (char c in s.ToCharArray()) { al.Add(c); } string output = “”; Random rand = new Random(); int counter; do { counter = (int)(al.Count * [...]

SQL – Random String

IF EXISTS (SELECT * FROM [dbo].[sysobjects] WHERE ID = object_id(N’[dbo].[usp_RandomString]‘) AND OBJECTPROPERTY(id, N’IsProcedure’) = 1) DROP PROCEDURE [dbo].[usp_RandomString] GO CREATE PROCEDURE usp_RandomString ( @Length INTEGER ) AS BEGIN   DECLARE @ValidChar VARCHAR(255) = ‘ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890~!@#$%^&*_+’   DECLARE @Random VARCHAR(255) = ”      WHILE @Length > 0   BEGIN     SET @Length = @Length -1 [...]