Results 1 to 5 of 5

Thread: newbie help

  1. #1
    Join Date
    Aug 2011
    Posts
    2

    Unanswered: newbie help

    Hi i need help converting the oracle code to mssql code. I am not familiar with database syntax. I keep getting an error message about binding variables. Can someone assist?

    Old code below:

    SELECT red.exp_defn_id, red.defn_name, s1.name as pre, s2.name as post, t.name as service_type
    FROM rsk_exposure_defn red, avs_script_header_view s1, avs_script_header_view s2, ops_service_type t
    WHERE defn_result_type = 1
    AND red.script_id = s1.script_id (+)
    AND red.update_script_id = s2.script_id (+)
    AND red.defn_subtype = t.id_number

    Thanking you in advance.

  2. #2
    Join Date
    Mar 2007
    Location
    Holmestrand, Norway
    Posts
    332
    Code:
    SELECT red.exp_defn_id, red.defn_name, s1.name as pre, s2.name as post, t.name as service_type
    FROM 
      rsk_exposure_defn red red.defn_subtype = t.id_number
      inner join ops_service_type t on 
      left outer join avs_script_header_view s1 on red.script_id = s1.script_id
      left outer join avs_script_header_view s2 on red.update_script_id = s2.script_id
    WHERE defn_result_type = 1
    Ole Kristian Velstadbråten Bangås - Virinco - MSSQL.no - Facebook - Twitter

  3. #3
    Join Date
    Aug 2011
    Posts
    2

    I

    I get an syntax error near the word red? Appreciate your time.

    Quote Originally Posted by roac View Post
    Code:
    SELECT red.exp_defn_id, red.defn_name, s1.name as pre, s2.name as post, t.name as service_type
    FROM 
      rsk_exposure_defn red red.defn_subtype = t.id_number
      inner join ops_service_type t on 
      left outer join avs_script_header_view s1 on red.script_id = s1.script_id
      left outer join avs_script_header_view s2 on red.update_script_id = s2.script_id
    WHERE defn_result_type = 1

  4. #4
    Join Date
    May 2009
    Posts
    508
    Provided Answers: 1
    At a guess try moving this after the ON of the Inner Join table.
    Code:
    SELECT red.exp_defn_id, red.defn_name, s1.name as pre, s2.name as post, t.name as service_type
    FROM 
      rsk_exposure_defn red 
      inner join ops_service_type t on red.defn_subtype = t.id_number
      left outer join avs_script_header_view s1 on red.script_id = s1.script_id
      left outer join avs_script_header_view s2 on red.update_script_id = s2.script_id
    WHERE defn_result_type = 1

  5. #5
    Join Date
    Mar 2007
    Location
    Holmestrand, Norway
    Posts
    332
    You're right, a bit too fast cut'n laste there, sorry for that :-)

Posting Permissions

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