SQL Server stored procedure for transform.rb