September 18, 2009 at 6:32 am
Hi all
I can't find an elegant solution for this seemingly simple problem.
I have a table (Job) with a field that includes a timestamp.
I need to draw a report for the number of records in table Job per day / hour / minute for the day / week month.
Something like this:
DateJobCount
September 18, 2009 at 7:33 am
Does your table have another field that is actually related to the date of the records? Despite its' name, a timestamp field has nothing to do with time and cannot be used for this kind of query.
If you do have another date field, please post the table definition for us and you're right, it is a very simple query. If you do not have another date field, you're hosed. Timestamps cannot be used for chronological sorting.
September 18, 2009 at 7:38 am
BOL[
timestamp
timestamp is a data type that exposes automatically generated binary numbers, which are guaranteed to be unique within a database. timestamp is used typically as a mechanism for version-stamping table rows. The storage size is 8 bytes.
Remarks
The Transact-SQL timestamp data type is not the same as the timestamp data type defined in the SQL-92 standard. The SQL-92 timestamp data type is equivalent to the Transact-SQL datetime data type.
A future release of Microsoft® SQL Server™ may modify the behavior of the Transact-SQL timestamp data type to align it with the behavior defined in the standard. At that time, the current timestamp data type will be replaced with a rowversion data type.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply