Skip to content

Instantly share code, notes, and snippets.

-- ORACLE GIST
-- ERR -> ORA-28001: The password has expired
-- ------------------------------------------------------------------
-- en windows, Open CMD ->
sqlplus sys/root as sysdba
-- Verificando permisos y fecha de expiracion
SELECT username, account_status, expiry_date FROM dba_users;
# diferencia entre branchs
$ git diff mybranch master -- /myfile.cs
# usando meld o kdiff (previamente instalados)
$ git difftool mybranch master -- myfile.cs
# Diferencia con un stash de otro branch y el branch actual
git difftool stash@{0} -- app/Belcorp.Api/Content/Site.css
# Show files into stash with detail of the changes (-p: patch form - forma de parche)
@jrodev
jrodev / sonar-install-and-run.sh
Last active May 11, 2018 23:04
Instalacion y ejecucion de Sonar sobre Linux
# Actualizando linux
$ sudo apt-get update
$ sudo apt-get -y upgrade
# Agregando repositorio para instalar Java JDK8
$ sudo add-apt-repository ppa:webupd8team/java
# Update repository metadata.
$ sudo apt-get update

RegEx-Based Finding and Replacing of Text in SSMS

So often, one sees developers doing repetitive coding in SQL Server Management Studio or Visual Studio that would be much quicker and easier by using the built-in Regular-Expression-based Find/Replace functionality. It is understandable, since the syntax is odd and some features are missing, but it is still well-worth knowing about. The Find/Replace feature of SQL Server Management Studio (SSMS) supports Regular Expressions. ‘Nice,’ you will think ‘This will be very handy for those refactoring jobs that would otherwise require programmers’ editor.’ Because you know that SSMS is a .NET application, you’ll imagine that it uses the lovely Regular Expression library that is within .NET. Actually, it doesn’t. It uses a quirky implementation of regular expressions, with unusual syntax, and few advanced features.

Here it is being used in SSMS. It is Microsoft’s standard RegEx implementation for Find/Replace in its applications. It comes from way back befo

CREATE FUNCTION [dbo].[parseJSON]( @JSON NVARCHAR(MAX))
-- Create by Phil Factor 15 November 2010
-- Update by Kaden Mai 21 August 2014
-- How to Use http://mtkcode.blogspot.com/2014/08/parse-json-string-by-sql-script.html
RETURNS @hierarchy TABLE
(
element_id INT IDENTITY(1, 1) NOT NULL, /* internal surrogate primary key gives the order of parsing and the list order */
@jrodev
jrodev / tableToJson.sql
Last active October 2, 2017 23:12
Convertir Tabla a Json con SQL Server < 2016
ALTER PROCEDURE dbo.GetJSON @ObjectName VARCHAR(255), @registries_per_request smallint = null
AS
BEGIN
IF OBJECT_ID(@ObjectName) IS NULL
BEGIN
SELECT Json = '';
RETURN
END
--SELECT CAST('<xml>Yep this is xml</xml>' AS XML)