I am writing a Stored Procedure to execute a Script with If then Statements. I am having a Hard time with the Inital Select Statment at the end where I am trying to compare a variable in the Statement. There should be a way to write this I just don’t know how?
SET @SearchSQL = ‘Select FD__MED_SURR.Today_date, FD__MED_SURR.Med_Name, FD__MED_SURR.MED_QU, FD__MED_SURR.MedAction, FD__MED_SURR.Docaction , FD__MED_SURR.OP__DOCID, FD__MED_SURR.Clientkey, FD__MED_SURR.Admissionkey From FD__MED_SURR Where @Clientkey = Clientkey and @Admissionkey = Admissionkey’
at the end of the stored proc it executes the @SearchSQL