By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,689 Members | 1,915 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,689 IT Pros & Developers. It's quick & easy.

Date Problem in sql Server 2008 R2

P: 1
Hello Friends,
I have some problem in sql server.
i created a storeprocedure with compare table [column] date witch difine varchar() and compare to getdate(). when compare it not proper work it gives only current month proper result not[previous or next month]....

here is my query....

Expand|Select|Wrap|Line Numbers
  1. update tablename
  2. set DatalinkStatus='Visit Not Successfully' where convert(varchar(10),CallingDateAgree,103)<convert(varchar(10),getdate(),103) and status='disable'
May 1 '13 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 10K+
P: 12,430
Please use code tags when posting code.

Dates should be compared as dates, not strings. If you're going to convert dates to strings, then you need to put the string in a format where the unit of time goes from largest to smallest from left to right.
May 1 '13 #2

Expert 2.5K+
P: 2,878
Here, read this...

Good Luck!!!

~~ CK
May 1 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.