Author Archives: admin

Renombrar un archivo con la fecha y hora en DOS

 @Echo Off set t=%time% set t=%t: =0% set t=%t:.=% set t=%t::=% For /F "tokens=1-4 delims=/" %%A in (‘echo %date%’) Do Set DT=%%A%%B%%C set D=%DT:~4,8% copy %1.txt %1-%D%-%t%.txt

Share
Posted in General | Leave a comment

Cómo calcular diferentes fechas con TSQL

 Aquí hay una lista de cómo calcular diferentes fechas con TSQL Anuales Primer día del año actual:  DATEADD(yy, DATEDIFF(yy,0,GETDATE()), 0) Último día del año actual:  DATEADD(dd,-1,DATEADD(yy,0,DATEADD(yy,DATEDIFF(yy,0,GETDATE())+1,0)))   Último día del año anterior:  DATEADD(ms,-3,DATEADD(yy, DATEDIFF(yy,0,GETDATE() ), 0)) Mensual   Primer día … Continue reading

Share
Posted in Programming | Tagged , , | Leave a comment

Cómo eleminar entradas duplicadas con CTE (Common Table Expression)

 Esta es una de las formas de eliminar entradas duplicadas utilizando CTE (Common Table Expression) en MS SQL.    /* Eliminar entradsa duplicadas */ WITH CTENombre (Col1,Col2, ConteoDeDuplicados) AS ( SELECT Col1,Col2, ROW_NUMBER() OVER(PARTITION BY Col1,Col2 ORDER BY Col1) AS ConteoDeDuplicados … Continue reading

Share
Posted in Programming | Tagged , , , | Leave a comment