renatoes 22 de fev. de 2008
Boa tarde,
Qual servidor de banco de dados esta utilizando? Eu trabalhei somente com PostgreSQL, mas estou colocando um link para funcoes de data do MySQL
http://www.postgresql.org/docs/8.0/interactive/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
[google]postgresql date functions[/google]
[google]mysql date functions[/google]
EDIT: Muito bacana (e util) o botao para pesquisa no google e etc
[]`s
feltraco 22 de fev. de 2008
estou usando MySql
estou a procura de uma função ou valor Default para a data
que sempre que atualizado o registro atualize automaticamente a data…
caso nao seja possivel irei fazer no java msm, sem problemas
mas queria saber se tem como deixar isso automatico…
renatoes 22 de fev. de 2008
Utilizando as funcoes do banco de dados vc consegue (utilizando triggers)
http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html
De uma pesquisada no google
[]`s
peerless 22 de fev. de 2008
feltraco 22 de fev. de 2008
não exatamente…
o CURRENT_TIMESTAMP, só pega a data de inserção…
VLwS
renatoes 22 de fev. de 2008
peerless,
Ai depende se ele esta utilizando o campo como TIMESTAMP
Lendo os comentarios da pagina, achei um interessante:
user_created_date timestamp default CURRENT_TIMESTAMP COMMENT ‘creation timestamp’,
user_updated_date timestamp default ‘20070101000000’ COMMENT ‘edit timestamp’,
This will work. If you try to set the second timestamp field to ON UPDATE CURRENT_TIMESTAMP it will then report
#1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
It seems to me the function of having both a creation timestamp set once by the default and an edit timestamp set repeatedly on update is NOT SUPPORTED by MySQL.
Ja enfrentou tal situacao?
peerless 22 de fev. de 2008
renatoes:
peerless,
Ai depende se ele esta utilizando o campo como TIMESTAMP
Lendo os comentarios da pagina, achei um interessante:
user_created_date timestamp default CURRENT_TIMESTAMP COMMENT ‘creation timestamp’,
user_updated_date timestamp default ‘20070101000000’ COMMENT ‘edit timestamp’,
This will work. If you try to set the second timestamp field to ON UPDATE CURRENT_TIMESTAMP it will then report
#1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
It seems to me the function of having both a creation timestamp set once by the default and an edit timestamp set repeatedly on update is NOT SUPPORTED by MySQL.
Ja enfrentou tal situacao?
Hmm. Não! Mas acredito que seja por aí o caminho…
T+