parameters to SP to Insert/Update

  • Hi

    Currently the data is on a third party server.

    When ever the data is inserted/modified/deleted on that server, I need to do corresponding operations on SQL. So I am writing a stored proc to do that operations and it will be executed every 3 mins.

    I am stuck with writing this SP, where I am confused, how to pass that many parameters to the SP.

    CREATE PROC [dbo].[USP_dataImport]

    (

    @VideoID VARCHAR(50),

    -- HOw to pass list of parameters and update only updated values

    )

    AS

    BEGIN

    DECLARE @errNum AS INTEGER;

    DECLARE @errDesc AS NVARCHAR(400);

    DECLARE @ErrorMessage AS NVARCHAR(4000);

    DECLARE @VidId AS NVARCHAR(500);

    BEGIN TRY

    -- GET Video Attributes

    SELECT @VidId = videoId FROM [Order] WHERE [tbldata].videoId = @VideoID

    -- CHECK IF RECORD FOR THE VIDEOID EXISTS IN THE TABLE

    IF EXISTS(@VidId)

    BEGIN

    -- Update corresponding values

    UPDATE tbldata

    SET lastUpdatedDate = GETDATE()

    WHERE videoId = @VideoID

    END

    ELSE

    BEGIN

    --INSERT THE RECORD

    --INSERT INTO tbldata(videoId,videoName,shtDsc,lngDsc,

    --relLinkText,relLinkURL,tags,

    --videoStillUrlcreatedOn)

    --VALUES(@VideoID ,,getdate())

    END

    --NO FURTHER PROCESSING EXIT SP

    RETURN -1 --To Quit the SP

    END TRY

    List<Video> Videoslist = VideoFunctions.GetVideos(SortByType.MODIFIED_DATE,

    SortOrderType.DESC,

    new List<String>(VideoFieldsToRetrieve),

    true, true);

    foreach(video in Videoslist )

    I am thinking i should call that SP here by looping

    but I dont know how to implement it

    cAn any one help me please

  • What data has been changed ?

    what you need to track ?

    Explain in brief your requ is not clear

    For better, quicker answers on T-SQL questions, click on the following...

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...

    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

    Thanks

    Parthi

    Thanks
    Parthi

  • This was removed by the editor as SPAM

  • If you're using SS2K8 (as indicated by the forum selected), you could pass the parameter using a table variable. That would avoid the additional overhead caused by XML tags.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • This was removed by the editor as SPAM

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

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