Help with Stored Procedure

Results 1 to 1 of 1

Thread: Help with Stored Procedure

  1. #1
    Join Date
    Dec 1969

    Default Help with Stored Procedure

    Here is my problem.I have one table named tblCourse. This has an id, topic and tblName columns. Based on the user&#039s selection from a drop down list I need to dynamically pass the correct tablename as a parameter to a stored procedure.HERE IS THE CODE:/* ---------------------------------------------------- */CREATE PROCEDURE dbo.GetQuestionDetails_SP @question_number int ASSELECT question_number AS [QUESTION#], question_text AS [QUESTION], answer_a AS [A], answer_b AS [B], answer_c AS [C], answer_d AS [D], answer_e AS [E] FROM tblFinal (THIS IS WHAT I WANT TO PASS AS A PARAMETER)where @question_number = question_numberI can create a SQL statement in asp that performs the same function but I want to utilize a stored procedure.VBScript sqlstmt = "SELECT question_number, yada, yada, yada FROM " & subject (This is the table name I retrieved from the dropdown) & "WHERE question_number ="&MyArray(Counter)set rsQuestionInfo = objCmd.Execute(sqlStmt)What am I missing or am I off the deep end now?jay
    Ladder day saints - mormonism forum
    Last edited by Jay; 04-16-2011 at 01:24 AM.

Posting Permissions

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