Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jonekim
Starting Member
35 Posts |
Posted - 2012-04-06 : 11:22:40
|
I've 3 tables:1. userTABLE - USERNAME (jone)2. productTABLE - prd_name (prd1, prd2, prd3)3. paidTABLE - USERNAME - prd_name - paid_amt My query is to insert amount paid by jone for the 3 products. One way is: I've to seperately insert paid amts by jone for every product he buys.create proc paid @USERNAME varchar, @prd_name int, @paid_amt intasinsert into paidTABLE values (@USERNAME, @prd_name, @paid_amt ) Is there any way to insert the value of paid_amt at once in the table by jone for the 3 products? |
|
jonekim
Starting Member
35 Posts |
Posted - 2012-04-06 : 11:27:40
|
My another query is:how to delete the value of particular entity. suppose I want to delete only the value of prd_name but not USERNAME & paid_amt from the paidTABLE for a given row? |
|
|
Xiez
Starting Member
13 Posts |
Posted - 2012-04-06 : 18:30:18
|
I'm having troubles understanding what you're asking, but I THINK what you're wanting to do is use the UPDATE function.A google search will help with the syntax, but it's something like:UPDATE paidTABLESET prd_name = nullWhere USERNAME = 'Bob' |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-06 : 21:00:13
|
quote: Originally posted by jonekim I've 3 tables:1. userTABLE - USERNAME (jone)2. productTABLE - prd_name (prd1, prd2, prd3)3. paidTABLE - USERNAME - prd_name - paid_amt My query is to insert amount paid by jone for the 3 products. One way is: I've to seperately insert paid amts by jone for every product he buys.create proc paid @USERNAME varchar, @prd_name int, @paid_amt intasinsert into paidTABLE values (@USERNAME, @prd_name, @paid_amt ) Is there any way to insert the value of paid_amt at once in the table by jone for the 3 products?
how do you get amounts for the products? is it input by users?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
jonekim
Starting Member
35 Posts |
Posted - 2012-04-07 : 02:21:38
|
@ visakh16.the amounts for the products are the input by the users. i.e they should be input in exec statement |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-08 : 18:15:33
|
how do you input multiple values?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|