Ver Mensaje Individual
  #5 (permalink)  
Antiguo 05/12/2017, 09:39
Avatar de Libras
Libras
Colaborador
 
Fecha de Ingreso: agosto-2006
Ubicación: En la hermosa perla de occidente
Mensajes: 7.412
Antigüedad: 17 años, 8 meses
Puntos: 774
Respuesta: Convert fecha a bigint SQL Server 2016

Aqui la respuesta:

Código SQL:
Ver original
  1. DECLARE @TIME CHAR(23)
  2. DECLARE @DATE CHAR(23)
  3. DECLARE @completa CHAR(200)
  4. DECLARE @mybigint BIGINT
  5.  
  6. SET @TIME=REPLACE(CONVERT(VARCHAR(8), dateadd(hh,2,getdate()), 8),':','')
  7. SET @DATE=REPLACE(CONVERT(CHAR(23),getdate(),101),'/','')
  8. SET @completa=ltrim(rtrim(@DATE)) + ltrim(rtrim(@TIME))
  9. SET @mybigint=CONVERT(BIGINT,@completa)
  10. print @mybigint

Resultado:
12052017135619--Agregando las 2 horas
__________________
What does an execution plan say to t-sql query? Go f**k yourself, if you are not happy with me