Skip to content

Instantly share code, notes, and snippets.

View keie's full-sized avatar
💭
I may be slow to respond.

Kevin Nava keie

💭
I may be slow to respond.
  • Caracas venezuela
View GitHub Profile
@javierguerrero
javierguerrero / gist:2698097
Created May 14, 2012 23:41
Cómo extraer un número desde una cadena en SQL Server
CREATE FUNCTION dbo.EXTRACT_YEAR(@periodo AS VARCHAR(max))
RETURNS INT
AS
BEGIN
WHILE PATINDEX('%[^0-9]%', @periodo) > 0
BEGIN
SET @periodo = REPLACE(@periodo,SUBSTRING(@periodo,PATINDEX('%[^0-9]%', @periodo),1),'')
END