• ok i just tested this, but i made some assumptions;

    when you say "

    I THINK you are saying "If I pass this string 'd;c;b;a;e', i want the companies ordered in that order, instead of normal alphabetical order"

    If I read that right, then this works correctly. my example is using sys.objects as sample data. so you see Defaults, then check constraints, then foreign keys in that order, for example:

    oh yeah, like many good solutions, you need the DelimitedSplit8K function:

    http://www.sqlservercentral.com/articles/Tally+Table/72993/

    select * from sys.objects

    OUTER apply master.dbo.delimitedsplit8k('d;c;b;a;e',';') myfn

    ORDER BY CASE WHEN LEFT(name,1) = myfn.Item THEN 1 ELSE 2 END,myfn.ItemNumber

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!