Dynamic number of parameters for FilterClause

Answered Dynamic number of parameters for FilterClause

  • maandag 9 augustus 2010 8:16
     
      Bevat code

    Hi again,

    while digging deeper into my scenario i came across the problem of defining a SyncTable description with a set of multiple parameters. As far as i understood the docs this is not possible with the current CTP - but it would be a very handy feature.

    Having a hard time to express what i mean i just give you an example:

    SELECT * FROM MyTable WHERE MyColumn IN (4, 8, 15, 16, 23, 42)
    
    <SyncTable Name="MyTable" FilterClause="[side].MyColumn IN (@MyFilterArray)">
    

     

Alle reacties

  • maandag 9 augustus 2010 18:32
    Moderator
     
     

    What would be the SqlType of MyFilterArray? I dont think TSQL lets you specify an array. If your array length is always fixed then you can probably do the following

    FilterClause="[side].MyColumn IN (@p1, @p2, @p3)"

     


    Maheshwar Jayaraman - http://blogs.msdn.com/mahjayar
  • dinsdag 10 augustus 2010 7:27
     
     

    Well, yes, of course you are right. I just wanted to give a simple example of what i would like to achieve - somehow. As the topic says i am looking for a dynamic number of parameters. All i can think of is some kind of hackish workarrounds, e.g. defined a fixed list of parameters and fill them with placeholder values in case they are not all needed.

    I was wondering if someone else comes up with a briliant idea?

  • dinsdag 10 augustus 2010 20:26
    Moderator
     
     Antwoord
    Not really as this is a property of the underlying SqlSyncProvider the service uses. The thing with dynamic filter values is that the provider still expects them to be same across sync sessions as it does not guarantee partition realignments if they change between sync calls. Hope that helps.
    Maheshwar Jayaraman - http://blogs.msdn.com/mahjayar
    • Als antwoord gemarkeerd door M.Bi woensdag 11 augustus 2010 6:55
    •