view multiple input

  • hi

    how to give multiple input to a field for a column for search in view.like

    where name in (a,d,f,g,...)

    and lastname in (n,df,gg...)

  • Two options, write a function that takes the comma delimited list and turns into a table or pass the list in as XML and use OPENQUERY or XQuery to join the list to your tables.

    Neither of these options will work directly within a view. You can't pass parameters to a view. You'd have to write a stored procedure.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • CREATE VIEW vw_SomeTable

    AS

    SELECT * FROM SomeTable WHERE SomeID IN( 1, 2, 3 ) AND SomeDate IN( '20060101', '20070101' )

    EDIT:

    Damn....I guess, I misunderstood the post....;)

    --Ramesh


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

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