SQL Web Service Stored Procedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • btcarver
    New Member
    • Oct 2006
    • 1

    SQL Web Service Stored Procedure

    Hello, I am working on a web service for retreving news updates and need some help with a stored procedure.

    I have 3 tables

    1. tblstory ( to hold the news article, headline, date etc)
    fldstoryID (PK)
    fldheadline
    fldstory
    flddate
    fldtype

    2. tblsymbol ( to hold stock symbol, company name, industry)
    fldsymbolID (PK)
    fldsymbol
    fldcompanyname
    fldindustry

    3. tblstorysymbol ( to hold the storyID and symbolID - many to many)
    fldstorysymbolI D (PK)
    fldstoryID (FK)
    fldsymbolID (FK)

    I want to be able to have a stored procedure to insert a new story into the above tables by sending it the symbol, headline, story, date, and category.

    A. It has to create a tblstory record with the passed headline, story, date and category
    B. Lookup the passed stock symbol in tblsymbol and return the symbolID of that stock symbol if it exists otherwise add the stock symbol to the tblsymbol
    C. Create a tblstorysymbol record with the storyID and stockID

    If you have any suggestions I would appreciate it. This is being done in MSSQL 7.

    Here is a copy of the view I use in case it helps-

    SELECT dbo.tblsymbol.f ldsymbol AS Symbol, dbo.tblstory.fl dheadline AS Headline, dbo.tblstory.fl dstory AS Story, dbo.tblstory.fl ddate,
    dbo.tblstory.fl dtime
    FROM dbo.tblsymbol LEFT OUTER JOIN
    dbo.tblstorysym bol ON dbo.tblsymbol.f ldsymbolID = dbo.tblstorysym bol.fldsymbolID FULL OUTER JOIN
    dbo.tblstory ON dbo.tblstorysym bol.fldstoryID = dbo.tblstory.fl dstoryID
    WHERE (dbo.tblsymbol. fldsymbol = '[GOOG]')



    Thanks in advance
Working...