how to build a Selection string

  • Dear All

    i develop a asp.net aplication for the company suggestions suggestion are assosiated with departments

    like

    1, A

    2, B

    3, C

    4, D

    5,E

    i stord data in suggestion table for suggestion are good for which which departments with "," seprated values

    like

    1,2

    1

    3

    4,5

    2,3

    1,2,5

    2,5

    1,4

    now im working on report use SQL Reproting

    i have a prb if i want to see all those Records belongs to department A

    correct result is

    1,2

    1

    1,2,5

    1,4

    but my query return only

    one result that is

    1

    what can i do

    any idea how to slove this prb

    thanks in advance

    Ahmer Ali

  • Hi,

    What have you used cursor and split function for this work, if not then use both of these and get your result. I m sure that it will give result of your problem.

    Regards

    Sarvesh kumar gupta 😎

  • The whole idea of using SQL Server as relational storage engine is to not store things in a comma seperated field. You're going to have problems with that. Instead it should have been stored as a series of rows associated to the correct foreign key. Then you can run a report.

    To really get help, you'll have to post the SQL query that you're running. Also, show the structure that you've created so that anyone attempting to help doesn't have to guess.

    "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

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

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