将金额添加到表中的金额 [英] Add amount to amount in table

查看:80
本文介绍了将金额添加到表中的金额的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



希望有人可以帮助我,我想
添加一定量(取决于参数)将其添加
达到我表中的金额.

我将使用哪种类型的程序进行此类操作?

这是我尝试过的:

Hi,

Hope someone can help me with this, I want to
add certain amount(Depending on parameter) add it
to the amount in my table.

What type of procedure would I use for something like this?

This is what i have tried:

create proc usp_CancelSale
@Name nvarchar(50),
@Quantity nvarchar (50)
as
update tblSales 
set
Product = @Name,
Amount  = COUNT(@Quantity)
where Product = @Name





PLEASE ANY HELP WOULD BE APPRICIATED.

推荐答案

如果我理解正确,如果要将数量添加到数量中,则可以使用类似以下内容:
If I understood correctly, if quantity is going to be added to the amount then you could use something like:
update tblSales
set
Product = @Name,
Amount  = Amount + @Quantity
where Product = @Name


现在,@ Quantity在参数中也定义为nvarchar (50).如果是数字,则应为参数使用正确的数据类型(十进制,整数,...)


Also the @Quantity is now defined as nvarchar (50) in the parameters. If it''s a number you should use proper datatype for the parameter (decimal, int, ...)


这篇关于将金额添加到表中的金额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆