Solved

update

Posted on 2013-05-30
1
340 Views
Last Modified: 2013-05-30
I am not sure how to write this update statement, depending on @feeoption.

create procedure  Updatefees
@id   int,
@amountpay    int,
@amount_customer  int,
@feeoption   varchar(6)

as

if @feeoption = 'both'
    update mytable  set payaccount = '0', set payclient = '0' where id =@id
if @feeoption = 'client'
    update mytable  set payaccount = @amountpay ', set payclient = '0'  where id =@id
if @feeoption = 'customer'
   update mytable set payaccount = @amountpay ', set payclient = @amount_customer   where id =@id
0
Comment
Question by:VBdotnet2005
[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 1

Accepted Solution

by:
manbehindthecurtain earned 500 total points
ID: 39209599
create procedure  Updatefees
@id   int,
@amountpay    int,
@amount_customer  int,
@feeoption   varchar(6)

as

if @feeoption = 'both'
begin
    update mytable  set payaccount = '0',  payclient = '0' where id =@id
    end
if @feeoption = 'client'
begin
    update mytable  set payaccount = @amountpay ,  payclient = '0'  where id =@id
    end
if @feeoption = 'customer'
begin
   update mytable set payaccount = @amountpay ,  payclient = @amount_customer   where id =@id
   end
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

726 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