我必须更新列数据类型为整数的表,但我有一个输入作为日期时间。这是我写过的查询
UPDATE T_SCH_ETAX_TEMP SET CURRTIME = UNIX_TIMESTAMP (TIMEDIFF(“(SELECT DATE_FORMAT(?,'%H:%i:%s')TIMEONLY)”,“(SELECT DATE_FORMAT(CURRENT_TIMESTAMP,'%H:%i:%s')TIMEONLY)“),LENGTHTIME = UNIX_TIMESTAMP(TIMEDIFF(“(SELECT DATE_FORMAT(?,'%H:%i:%s') TIMEONLY)“,”(选择DATE_FORMAT(CURRENT_TIMESTAMP,'%H:%i:%s') TIMEONLY)“)
任何人都可以帮助如何将时间戳结果转换为整数,以便我可以使用SSIS更新表
答案 0 :(得分:0)
我可能是错的,请原谅我,如果我是,但你似乎想要更简单的东西:
UPDATE T_SCH_ETAX_TEMP
SET CURRTIME = UNIX_TIMESTAMP(
TIMEDIFF(TIME(?),
TIME(CURRENT_TIMESTAMP))),
LENGTHTIME = UNIX_TIMESTAMP(
TIMEDIFF(TIME(?), TIME(CURRENT_TIMESTAMP)));
只需要2个参数(' ss');
如果是这种情况,可以简化为:
UPDATE T_SCH_ETAX_TEMP
SET CURRTIME = UNIX_TIMESTAMP(
TIMEDIFF(?,
CURRENT_TIMESTAMP)),
LENGTHTIME = UNIX_TIMESTAMP(
TIMEDIFF(?, CURRENT_TIMESTAMP));
如果您预先格式化参数字符串