Solved

How to use is equal to in stored proc?

Posted on 2009-04-07
1
202 Views
Last Modified: 2012-05-06
Hi

I need to select 2 values from 2 fields of 2 tables and compare them.

It has error:
Msg 102, Level 15, State 1, Procedure SP_Transaction, Line 13
Incorrect syntax near '='.
Msg 102, Level 15, State 1, Procedure SP_Transaction, Line 14
Incorrect syntax near ')'.


If ((select sum(amount) as amount from subtransaction where transactionsid=43) = 
(select amount from transactions where id=43) and 
(select sum(payoutamount) as payoutamount from subtransaction where transactionsid=47 =
(select countervalue from transactions where id=47))
 
update transactions set status = 3 where id =43
update subtransaction set status = 3 where id =47

Open in new window

0
Comment
Question by:techques
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
AlvinLim84 earned 50 total points
ID: 24087488
Try this:
If ((select sum(amount) as amount from subtransaction where transactionsid=43) = 
(select amount from transactions where id=43) and 
(select sum(payoutamount) as payoutamount from subtransaction where transactionsid=47) =
(select countervalue from transactions where id=47))
 
update transactions set status = 3 where id =43
update subtransaction set status = 3 where id =47

Open in new window

0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question