troubleshooting Question

Compare two dates in SQL Server T-SQL

Avatar of jamesdean666
jamesdean666 asked on
Microsoft SQL Server 2008
3 Comments2 Solutions710 ViewsLast Modified:
I have two dates in an SPROC that I am trying to compare..

What is the easiest way?  This is what I have (PERTINENT PARTS OF SPROC) as I believe the issue is with how I am comparing them:

-- parameter
@target_date date = NULL

DECLARE @original_target_date date = NULL

-- return @original_target_date
SELECT @original_target_date = target_date FROM TxPlus WHERE txplus_id = @txplus_id

the target_date could be updated after this point via update statement.

-- comparison
IF @target_date <> @original_target_date
Join our community to see this answer!
Unlock 2 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros