a simple store procedure

  • hi

    i want to write store procedure that it takes a "FileCode"

    and add "1" to a field wich name is "DownloadCount" only in that record

    i wrote this :

    ALTER PROCEDURE [dbo].[DownloadCount_SP]

    @FileCodesql int

    AS BEGIN

    select DownloadCount from [File]

    where FileCode=@FileCodesql

    update [File] set DownloadCount=DownloadCount+1

    END

    but it does not work successfully

    could you please help me?

    regards

  • Remove the select part and just keep this in your sp

    update [File]

    set DownloadCount=DownloadCount+1

    Where FileCode = @FileCodesql

    ---------------------------------------------------------------------------------

  • thanks a lot. you solved my problem

  • ur welcome 🙂

    ---------------------------------------------------------------------------------

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply