Sql Stored Procedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrsgwen90
    New Member
    • Sep 2007
    • 37

    #1

    Sql Stored Procedure

    I have 3 tables that I'm working with in Sql Reporting Services. tblParks, tblContacts, tblZone.

    I want to say: If "ContactID" IS NULL in tblParks THEN get "ZoneCoordinato r" in tblZones.

    How would I write this in Sql? Would I write it as a stored procedure?
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    What's the key that linked these tables?

    -- CK

    Comment

    • Delerna
      Recognized Expert Top Contributor
      • Jan 2008
      • 1134

      #3
      Here is how you do the use this field but if its null use another.
      I don't know how the tables should join as you don't provide enough info

      [code=sql]
      SELECT isnull(tblParks .ContactID,tblZ ones.ZoneCordin ator) as FieldName
      FROM TheTablesAndJoi nConditionsNesc essaryToProduce YourRequirement s
      [/code]


      If you need to pass parameters to the query for use in a WHERE clause then use a stored procedure. If no parameters (ie. the WHERE clause,if used, never changes) then use a view.

      Comment

      Working...