0
How do I convert a date into varchar? I tried to convert to normal mode but couldn’t, could anyone help me? I want DT_PAGAMENTO to be in "03/02/2021" format, in dynamic mode.
SELECT
NUMERO = CAST(SUBSTRING(BB.IDENT_TITULO, 8, LEN(BB.IDENT_TITULO)) AS BIGINT)
,VR_PAGO = CAST(AA.VLOR_PAGO AS FLOAT)/100
,DT_PAGAMETO = CONVERT(VARCHAR,AA.DATA_OCORRENCIA,103) <------
,DT_VENCIMENTO = BB.DATA_VENC_TITULO
INTO #PAGTO_SENAC
FROM
#REGISTRO_DETALHE_U AA,
#REGISTRO_DETALHE_T BB
WHERE
AA.LOTE = BB.LOTE
AND AA.ID = BB.ID
[date]
Thanks for your attention, but I was able to find a "shortcut" to solve this. If anyone else needs to know how it can work...
SELECT DT_PAGAMETO = SUBSTRING(AA.DATA_OCORRENCIA, 1,2) + '/' + SUBSTRING(AA.DATA_OCORRENCIA,3,2) + '/' + SUBSTRING(AA.DATA_OCORRENCIA,5,4)
– Cláudio Ramalho