1

I am calling one function using dynamic SQL query which accepts TVP. Is there any way to pass table values parameter in dynamic sql. One thing I can do to achieve this is to pass comma separated string and then convert this comma separated string to table. But the problem is then I have to convert string - table for each item in my table (The function is called for all the rows) which can be avoided if I can pass table in dynamic sql.

Thanks Ashwani

1
  • Passing an XML document is an option to you? Commented Feb 4, 2011 at 0:04

1 Answer 1

1

Certainly. Where inputTable is your TVP type and @test is the variable:

exec sp_executesql
 N'select
    t.*
   from @test as t
   where t.ID = 2'
,N'@test inputTable readonly' -- note the readonly
,@test
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.