SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

AskSQLTeam
Ask SQLTeam Question

USA
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
(
@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

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  
 New 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.06 seconds. Powered By: Snitz Forums 2000