Re: Can someone help with this SQL statement
From: Frank Hickman [MVP] (fhickman_NOSP_at_M_noblesoft.com)
Date: 02/19/05
- Next message: James Tucker: "Array Bounds Errors in Purify"
- Previous message: tawright915: "Re: Can someone help with this SQL statement"
- In reply to: tawright915: "Re: Can someone help with this SQL statement"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 18 Feb 2005 22:37:18 -0500
"tawright915" <tawright915@yahoo.com> wrote in message
news:1108767378.197573.267600@g14g2000cwa.googlegroups.com...
> Thanks for the help, but I'm still missing the last digit of the
> millisecond. I tried adding a zero to all parts but that came back
> with an error.
>
Yep, I finally caught the problem. You need to cast the result of the
datepart call to a bigint prior to the multiplication. Try it like so...
INSERT INTO TSK2 (TSK2_DATE_TIME, TSK2_PRIORITY, TSK2_ACTION)
(
SELECT (CAST(DATEPART(YEAR, CURRENT_TIMESTAMP) AS BIGINT)*10000000000000) +
(CAST(DATEPART(MONTH, CURRENT_TIMESTAMP) AS BIGINT)*100000000000) +
(CAST(DATEPART(DAY, CURRENT_TIMESTAMP) AS BIGINT)*1000000000) +
(CAST(DATEPART(HOUR, CURRENT_TIMESTAMP) AS BIGINT)*10000000) +
(CAST(DATEPART(MINUTE, CURRENT_TIMESTAMP) AS BIGINT)*100000) +
(CAST(DATEPART(SECOND, CURRENT_TIMESTAMP) AS BIGINT)*1000) +
(CAST(DATEPART(MILLISECOND, CURRENT_TIMESTAMP)),
0,
341
)
Looks better huh?
-- ============ Frank Hickman Microsoft MVP NobleSoft, Inc. ============ Replace the _nosp@m_ with @ to reply.
- Next message: James Tucker: "Array Bounds Errors in Purify"
- Previous message: tawright915: "Re: Can someone help with this SQL statement"
- In reply to: tawright915: "Re: Can someone help with this SQL statement"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|