תשובה Dynamic number of parameters for FilterClause

  • יום שני 09 אוגוסט 2010 08:16
     
      קוד כלול

    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)">
    

     

כל התגובות

  • יום שני 09 אוגוסט 2010 18:32
    מנחה דיון
     
     

    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
  • יום שלישי 10 אוגוסט 2010 07: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?

  • יום שלישי 10 אוגוסט 2010 20:26
    מנחה דיון
     
     תשובה
    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
    • סומן כתשובה על-ידי M.Bi יום רביעי 11 אוגוסט 2010 06:55
    •