Debasis Mohapatra

Debasis Mohapatra

  • NA
  • 381
  • 56.6k

Out of four option choose the one answer agnist the question

Feb 22 2019 4:52 AM
I have three table 
 
stype table,question table and the final table is fivesquestiondetails.
 
both the primay key id i have inserted in fivesquestiondetails table. Please check the my below store procedure code.
  1. CREATE PROCEDURE [dbo].[questionrecords]  
  2. AS  
  3. SET NOCOUNT ON  
  4. BEGIN  
  5. BEGIN TRY  
  6. BEGIN  
  7. select distinct q.question_name as 'Question',qd.question_option as 'Option',s.name from [dbo].[five_s_question] q inner join  
  8. [dbo].[five_s_question_details] qd on q.id=qd.question_id inner join [dbo].[five_s_sitetype] s on s.id=qd.stype_id  
  9. END  
  10. END TRY  
  11. BEGIN CATCH  
  12. DECLARE @ErrorMessage VARCHAR(MAX);  
  13. SELECT @ErrorMessage ='There was a problem trying to Retrieve Course Type'  
  14. Char(13) + Char(10) + 'The error was: ' + Char(13) + Char(10) + ERROR_MESSAGE()  
  15. RAISERROR (@ErrorMessage, 16, 1)  
  16. END CATCH  
  17. END  
  18. --exec questionrecords
three tables 
 
[dbo].[five_s_sitetype]
id, name, cbu, doc, mbu, dom
 
[dbo].[five_s_question]
id, question_name, weightage, stype_id, cbu, doc, mbu, dom, qstatus
 
[dbo].[five_s_question_details]
id, question_id, question_option, details_weightage, stype_name, stype_id, cbu, doc, mbu, dom

Answers (4)