Results 1 to 3 of 3

Thread: Ouput on Update

  1. #1
    Join Date
    Dec 2008
    Posts
    3

    Ouput on Update

    Hi, can anyone tell me why the following does not work? It falls over at the select statement (qData: Missing SQL property). If I comment out that line all is good. As far as I can see what I have done is identical to various examples on the net.

    Thanks

    David
    Code:
    CREATE PROCEDURE dbo.UpdateCardBalTest
    	@DebitAmount	money,
        @LastBranch		nvarchar(10),
        @LastUsed		smalldatetime,
        @SerialNo		NVARCHAR(15)	
    AS
    	DECLARE @upd TABLE(bal money, LastUsed nvarchar(10))
    UPDATE GiftCard
    	SET Balance = (Balance - @DebitAmount),
        BranchLastUsed = @LastBranch,
        LastUsed = @LastUsed,
        Status = 
        CASE 
        	WHEN (Balance - @DebitAmount) = 0 then 'C'
        ELSE Status
        END
        OUTPUT Inserted.Balance, Inserted.BranchLastUsed into @upd
    WHERE SerialNo = @SerialNo
    
    SELECT * FROM @upd

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Is it for sql server? What's error message?
    Last edited by rmiao; 10-12-2010 at 07:46 AM.

  3. #3
    Join Date
    Nov 2010
    Posts
    3
    I think the problems on the table Inserted. Because there is no inserted
    data, and I am not sure if the table Inserted is useful out of the trigger.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •