I have some dynamic SQL code that is executed using the following:
SET @.SQLSTRING = @.SELECT+@.FROM+@.WHEREPARM+@.ORDER
EXEC sp_executesql @.SQLSTRING
and this works fine if my @.WHEREPARM is
SET @.WHEREPARM = ' Where srm.EVENT_HISTORY.EVENT_DATE <> ampfm.rpt_Abstract.AbsCompleteDate'
However, it fails if my @.WHEREPARM is
SET @.WHEREPARM = ' Where srm.EVENT_HISTORY.EVENT_DATE <> ampfm.rpt_Abstract.AbsCompleteDate
and srm.EVENT_HISTORY.EVENT_TYPE_KEY = '460''
I am getting the following error: Incorrect syntax near '460'
I believe I need to change the number of apostrophes around the 460 value but can't quite figure this out. Can someone provide me a correct example?
Thanks!
Try 3 quotes at the end: '460'''
|||You are correct channge:
Code Snippet
and srm.EVENT_HISTORY.EVENT_TYPE_KEY = '460''
to
Code Snippet
and srm.EVENT_HISTORY.EVENT_TYPE_KEY = ''460'''
|||Thank you both for the quick response. The ''460''' did the trick.
No comments:
Post a Comment