SQL Query

  • I want to write query something like

    Select * from Table_Name where Column1 like ..

    now .. in query would be variable and may have n values. It would basically come from a sub query

    how to i achive this

  • Take a look at sp_executesql within Books Online. You can build a dynamic string and then execute that to get results.



    Shamless self promotion - read my blog http://sirsql.net

  • Select * from Table_Name as t inner join (sub query) as s

    on t.Column1 like s.col+'%'


    Madhivanan

    Failing to plan is Planning to fail

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply