Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 concurrency issue with last updated date from
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Ask SQLTeam Question

0 Posts

Posted - 08/30/2005 :  07:49:05  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
Edward writes "Greetings,
I have the following store procedure

Store Procedure

Update testTable
Set columntobeupdated = @columntobeupdated
where ID = @ID and lastupdateddate = @readdate

However, when I pass in the date from the front end
no rows are updated even though the data hasn't changed since I read it. I am guessing this is because the way sql server stores
dates as '2000-05-08 12:35:29.998' and when I look at the date
in VB.NET it is '2000-05-08 12:35:29 PM'. How can I get the dates to match up with out sacrificing concurrency?




United Kingdom
12543 Posts

Posted - 08/31/2005 :  16:23:31  Show Profile  Visit nr's Homepage  Reply with Quote
>> sql server stores dates as '2000-05-08 12:35:29.998'
No it doesn't. It stores dates as two binary numbers (or a decimal value depending on how you think of it).
What you are seeing is the value converted to text using your default settings.

If your app passes the value as a datetime (correctly) then you won't have a problem.
You can pass in a string in the format yyyymmdd hh:mm:ss.mmm and you won't have a problem but it's better to correct the app to pass the correct value.

Use the profiler or get the SP to save the value to a table to see what is passed in.

Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000