Skip to content

Instantly share code, notes, and snippets.

View tkMageztik's full-sized avatar

Juan José Ruiz de Castilla tkMageztik

View GitHub Profile
@tkMageztik
tkMageztik / gist:1985202bdc36d6a7e9c9
Created January 28, 2016 18:55
Problema de Halloween
http://sqlperformance.com/2013/02/t-sql-queries/halloween-problem-part-1
http://es.stackoverflow.com/questions/3283/orden-de-ejecuci%C3%B3n-de-varios-update-con-sql-server
@tkMageztik
tkMageztik / tablas_email_sqlserver2008r2.sql
Created January 25, 2016 17:34
tablas importantes troubleshotting correo
USE msdb
GO
sysmail_help_queue_sp @queue_type = 'Mail' ;
SELECT * FROM sysmail_allitems ORDER BY send_request_date DESC
SELECT * FROM sysmail_sentitems ORDER BY send_request_date DESC
SELECT * FROM sysmail_unsentitems
SELECT * FROM sysmail_faileditems
SELECT * FROM sysmail_event_log ORDER BY log_date DESC
@tkMageztik
tkMageztik / troubleshotting_correo.sql
Created January 25, 2016 17:34
script para troubleshotting ejecutable en sql server 2008r2+
-- ACTIVA EL MOSTRAR OPCIONES AVANZADAS EN SP_CONFIGURE
sp_configure 'show advanced', 1;
GO
-- COMO UN COMMIT PARA EL SCRIPT ANTERIOR
RECONFIGURE;
GO
-- MUESTRA LAS OPCIONES DE SP_CONFIGURE
sp_configure;
GO
@tkMageztik
tkMageztik / gist:a8b641f5e3fc641fb310
Created January 6, 2016 22:23
Decidir cuando usar una aplicación web en lugar de un sitio web
1)
http://vishaljoshi.blogspot.com/2009/08/web-application-project-vs-web-site.html
2) De donde se sacó la información y relativo al primer link.
http://stackoverflow.com/questions/7233521/reference-folder-in-solution-explorer-not-showing-vs2010
@tkMageztik
tkMageztik / importante_sobre_mail.sql
Last active November 25, 2015 20:45
importante_sobre_mail
-- ACTIVA EL MOSTRAR OPCIONES AVANZADAS EN SP_CONFIGURE
sp_configure 'show advanced', 1;
GO
-- COMO UN COMMIT PARA EL SCRIPT ANTERIOR
RECONFIGURE;
GO
-- MUESTRA LAS OPCIONES DE SP_CONFIGURE
sp_configure;
GO
@tkMageztik
tkMageztik / gist:5170668457bae1e48d1b
Last active August 29, 2015 14:13
Delete duplicates rows, except 1.
First of all, you need to decide what is the duplicate criteria that you will use. For example I want to check if the phone number is duplicate in the same Org Nro, company Name and postalcode. I can do this:
First table for test
CREATE TABLE TEST
(
id int,
phonenumber int,
orgno int,
companyname varchar(100),
@tkMageztik
tkMageztik / gen_drop_script
Created February 19, 2014 15:45
Genera sentencias para eliminación de constraints
SELECT
'ALTER TABLE ' + OBJECT_SCHEMA_NAME(parent_object_id) +
'.[' + OBJECT_NAME(parent_object_id) +
'] DROP CONSTRAINT ' + name
FROM sys.foreign_keys
WHERE referenced_object_id = object_id('Mantenimiento.SIC_T_ALMACEN')
@tkMageztik
tkMageztik / gist:8308846
Created January 7, 2014 23:28
Reiniciar valor identity de la columna de una tabla, donde el valor representa el número en donde quiere que se quede el índice, el siguiente registró será +1
DECLARE I INT
SET I = 0
DBCC CHECKIDENT('TABLA', RESEED, I)
@tkMageztik
tkMageztik / ADV_FS_NUM_LETRAS.sql
Created December 2, 2013 04:16
Permite generar la glosa de una factura, mediante la conversión de un monto a letras, en moneda peruana (nuevos soles).
CREATE FUNCTION [dbo].[ADV_FS_NUM_LETRAS](
@Numero NUMERIC(20,2) )
RETURNS VARCHAR(MAX)
AS
BEGIN
DECLARE @ImpLetra Varchar(180)
DECLARE @lnEntero INT,
@lcRetorno VARCHAR(512),
@lnTerna INT,
@tkMageztik
tkMageztik / gist:7308995
Created November 4, 2013 20:49
Patrones varios .NET
http://www.dofactory.com/Patterns/PatternAdapter.aspx#_self1