Dynamic T-SQL steatment

How can i build a T-SQL statement dynamically

Vivek S



Answer this question

Dynamic T-SQL steatment

  • Nilsson

    What type of component is using the SQL statement

    What component is failing

    What is the error

    Please supply more pertinent information otherwise its a bit dificult to be of assistance.

    As an aside, you really should consider using an expression rather than a script task to dynamically build your SQL statement.

    -Jamie



  • Tomik

    i have declared a variable of type string and initialised it with a T-SQL statement. The sql statement size is around 5000 characters. To have some run time modifications, i have used a script task and initialised the SQL to the variable so that it can take the changes at run time. i have used a DataflowTask within which accessing the variable for the SQL. But when i execute the ssis pkg it throws an error at the dft validation level as VS_ISBroken.
  • Mohammad Iqubal

    Do you mean within SSIS You should use an expression: http://www.google.co.uk/search hl=en&q=ssis+expressions&meta=

    If you mean to be used in (e.g.) a sproc then you're on the wrong forum. Try the T-SQL forum.

    -Jamie



  • Dynamic T-SQL steatment