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

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 concurrency issue with last updated date from vb.net

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-30 : 07:49:05
Edward writes "Greetings,
I have the following store procedure

Store Procedure
(
@ID
@readdate
@columntobeupdated

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

However, when I pass in the date from the vb.net 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?

Help!!

Ed"

nr
SQLTeam MVY

12543 Posts

Posted - 2005-08-31 : 16:23:31
>> 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
   

- Advertisement -