User Profile

Collapse

Profile Sidebar

Collapse
Begood
Begood
Last Activity: Jun 27 '14, 09:40 PM
Joined: Jun 23 '14
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Thank you ...........
    See more | Go to post

    Leave a comment:


  • How I will get Transaction Id value If I stored it in the Order table, the Order table is filled with data at first ..
    See more | Go to post

    Leave a comment:


  • my question is what is the required editing that SP need to store the Orders in Transaction table with one TrnId to let me then write query to calculate the total amount of the list of orders as group of TrnId.
    Suppose there is customer who buy (1-a,2-b,3-c) as names of products ) these products should store to OrderProduct Table with the quantity and Price for each one products so I have 3 fields in OrderProduct then these Orders supposed...
    See more | Go to post

    Leave a comment:


  • My SP store the orders in Transaction without specify the TrnId, there is no error, but I need to link orders with TrnId when It saved in Transaction table..

    OrderedProduct

    |Price|Quantity |ProductName|Or derId|
    |10 | 2 | A | 1 |
    | 80 | 1 | C | 2 |
    | 30 | 5 | B | 3 |
    | 60 | 3 | B | 4 |
    =============== =============== ==========...
    See more | Go to post

    Leave a comment:


  • Thank you for your reply, I have 2 tables one of them is OrderProduct (orderId P.K.,ProdctName ,Quantity,Price )which store the list of items that the customer want one by one , the second table I named it Transaction(Trn Id P.K.,orderId f.K.,Datetime) which it suppose to group the list of Orders by one TrnId, So the realtion between these 2 tables is one(TrnId)-to-many(Orders).
    In my SP I just store the orders without specifying TrnId ,
    ...
    See more | Go to post

    Leave a comment:


  • Begood
    started a topic Insert data into 2 tables one-to-many relation

    Insert data into 2 tables one-to-many relation



    I want to write a Stored Procedure for these 2 tables ,
    I have this SP but it doesn't achieve my point..


    Code:
    CREATE proc [dbo].[Sp_Insert]
    @prdctName NVARCHAR(50),
    @ordrdQnty INT,
    @ordrPrice MONEY
    --@TrnId INT
    
    AS BEGIN TRAN
    declare @TrnId int 
    
    set @TrnId = SCOPE_IDENTITY()
    --IDENT_CURRENT
    
    Insert into [OrderProduct]
    (prdctName
    ...
    See more | Go to post
No activity results to display
Show More
Working...