Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Invalid prompt Error in derived table

hello All,

I have the below query which works in SQL server...but the same query in derived table is giving invalid prompt error when instead of hardcoding the value...I gave  @prompt for user input value.

SELECT

  convert(varchar(6), dateadd(MM,-3, convert(datetime, substring(cast(EMR_REPORTING.dbo.vMH_MEASURE_PRACTICE.RPT_YEAR_MONTH as varchar), 5,2) + '/' + '30' + '/'+ substring(cast(EMR_REPORTING.dbo.vMH_MEASURE_PRACTICE.RPT_YEAR_MONTH as varchar), 1,4))), 112) as prequarter,

  Primed_Status,

  EHR

FROM

  EMR_REPORTING.dbo.vMH_MEASURE_PRACTICE

  where RPT_YEAR_MONTH = '201406'

SELECT

  convert(varchar(6), dateadd(MM,-3, convert(datetime, substring(cast(EMR_REPORTING.dbo.vMH_MEASURE_PRACTICE.RPT_YEAR_MONTH as varchar), 5,2) + '/' + '30' + '/'+ substring(cast(EMR_REPORTING.dbo.vMH_MEASURE_PRACTICE.RPT_YEAR_MONTH as varchar), 1,4))), 112) as prequarter,

  Primed_Status,

  EHR

FROM

  EMR_REPORTING.dbo.vMH_MEASURE_PRACTICE

  where RPT_YEAR_MONTH = @Prompt('Enter values for Rpt Year Month:','N','Folder\MeasurePractice\Rpt Year Month',Mono,Constrained)

Thanks in advance for any inputs.

Regards.

Not what you were looking for? View more on this topic or Ask a question