Solved

update

Posted on 2013-05-30
1
331 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
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
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 shrink a transaction log file down to a reasonable size.

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

13 Experts available now in Live!

Get 1:1 Help Now