Solved

How to use is equal to in stored proc?

Posted on 2009-04-07
1
198 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
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now