Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 1st, 2006, 03:20 AM
Registered User
 
Join Date: Apr 2006
Location: pune, maharashtra, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL 2000

i am facing problem In sql 2000 . I want to get date value with miliseconds or microseconds upto 6 digits.
I am comparing two date to avoid duplicate records

i stuck up on this point

Please somebody help me asap

Thanks [/font=Verdana][/size=4]

ashish
 
Old April 1st, 2006, 08:18 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

The DateTime datatype in SQL Server is stored as an 8 byte integer value. 4 bytes of this are used to represent the time of day as the number of milliseconds since midnight. It is accurate to 3.33 milliseconds, and values are rounded to the (roughly) nearest 3 milliseconds (0, 3, or 7).

You can't change this.

You'll have to use some other way to distingush data rows, say by using an identity column which will guarantee unique values, no matter how fast your data arrives.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
 
Old April 10th, 2006, 06:04 AM
Registered User
 
Join Date: Apr 2006
Location: pune, maharashtra, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Jeff

Thanks a Lot for your Reply. Ok means as per your statement we can not get miliseconds or microseconds in SQL syntax .

but do you have any other logic by which i can avoid diplicates records.

Example:
i have two records like this
'03/23/2006 12:31:38:536'
'03/23/2006 12:31:38:536'

How can avoid duplicate records and will get distinct results

Thanks ones

ashish



ashish
 
Old April 10th, 2006, 06:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

As I mentioned, if you cannot use a datetime to distingush rows because they arrive too fast for the resolution of the clock, so more than one row gets the same value, you'll have to depend upon some other form of a "uniquifier" to distingush the rows.

By far, the simplest is to use an identity column. The values are assigned by the system in a monotonicaly increasing order so you can use this value to distingush two rows with the same datetime value. Disregading some unusual circumstances, you can depend upon the fact that a row with a smaller identity value arrived "before" a row with a larger value.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com




Similar Threads
Thread Thread Starter Forum Replies Last Post
How Run .sql Script file in MS SQL Server 2000? aarkaycee SQL Server 2000 5 October 12th, 2009 05:43 AM
Upgrade 2000 DBs to 2005 or install SQL 2000/2005 cJeffreywang SQL Server ASP 0 February 13th, 2008 10:44 PM
looking for access 2000 to sql server 2000 sql/que method SQL Server 2000 0 July 7th, 2005 12:46 PM
SQL SERVER 2000 AND ACCESS 2000 ckentebe SQL Server 2000 3 June 17th, 2004 08:50 PM
Windows 2000 and SQL 2000 in Korean Language mipo SQL Server 2000 0 February 19th, 2004 12:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.