JSP x SQLServer

1 resposta
J

Estou fazendo uma página JSP usando o BD SQL Server, estou com dúvida para fazer um SELECT.

Na tabela tem um campo hora do tipo SMALLDATETIME, onde são armazenados o dia e a hora.

Como eu faço para pegar sómente a hora e somente a data?

Alguem pode me ajudar!!

Em MySQL e mole TIME() e DATE(), ehehehh!!

1 Resposta

B

para pegar somente a hora (hh:mm:ss) tente no select: CONVERT(char, data, 108)
para pegar somente a data (dd/mm/yy) tente no select: CONVERT(char, data, 103)

Se vc tiver dúvidas, vc pode olhar: http://www.microsoft.com/technet/prodtechnol/sql/2000/deploy/sqlorcle.mspx

Criado 21 de agosto de 2006
Ultima resposta 21 de ago. de 2006
Respostas 1
Participantes 2