Skip to Content
avatar image
Former Member

'Q'+substring(datename(m,Dateadd(ms,-3,Dateadd(qq, Datediff(qq,0,GetDate()), 0))),1,3) +''''+ substring(cast(datepart(yyyy,Dateadd(ms,-3,Dateadd(qq, Datediff(qq,0,GetDate()), 0))) as varchar),3,2)

Hi All

While am trying to run the above SQL in BODS Scirpt am finding a Syntax Error.

Can any help.

ODBC data source(DDTCSQL31.fremont.lamrc.net) error message for operation(SQLExecute): ([Microsoft][SQL Server Native Client 11.0 [SQL Sserver] Incorrect syntax near','.

regards

Karthik

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Apr 05, 2016 at 07:06 AM

    Hi Former Member

    Please follow the Scripting Guidelines. In some cases you need to provide the Escape Characters.

    Scripting Guidelines

    • Statements in a script object or custom function must end with a semicolon (;)
    • Comment lines must start with a # character.
    • Use single quotes for string constants.
    • Uses the backslash (\) as the escape character. E.g. single quote (') -> ' WHERE NAME LIKE \'SAURAV\' ' backslash (\) -> 'C:\\DS'

      Also strings including curly braces or square brackets cause a processing error. We can avoid the error by preceding the braces or brackets with a backslash (\).

    • Data Services does not strip trailing blanks from strings that are used in scripts or custom functions. To remove trailing blanks, we can use the rtrim or rtrim_blank function.
    • Variable Names must be preceded by a dollar sign ($).
    • Global Variables used in a script or expression must be defined at the Job level using the Variables and Parameters window.
    • Local Variables used in a script or expression must be defined in the Job or Workflow context that calls the script, using the Variables and Parameters window; Local variables used in a Custom Function must be defined using the Smart Editor.
    • The square brackets ([]) indicate that the value of the expression should be substituted.
    • The curly braces ({}) indicate that the value of the expression should be quoted with single quotation marks.


    Source:Data Services Scripting Language

    Regards,

    Akhilesh Kiran.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 05, 2016 at 02:28 PM

    Try to get this correct in your database client, first. Then add a backslash before every single quote when embedding it into a DS sql function call.

    Add comment
    10|10000 characters needed characters exceeded