AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
NAV
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 19.09.2008, 17:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Hi all,


Hynek at SQL Perform asked me to publish something about a myth being spread by some Microsoft specialists.





MYTH:


"Make sure that the order of the fields used for filtering is the same as order of these fields in the key."





REALITY:


Certainly the order of the filtering does NOT matter, nor in Classic, nor SQL Server. The driver does issue the filters according to the key anyway (because on classic it narrows the index tree...).





See an example below:





ItemLedgerEntry.SETCURRENTKEY(


"Item No.",Open,"Variant Code",Positive,"Location Code","Posting Date", "Expiration Date","Lot No.","Serial No.");


ItemLedgerEntry.SETRANGE("Lot No.",'HELLO WORLD');


ItemLedgerEntry.SETRANGE("Posting Date",WORKDATE);


ItemLedgerEntry.SETRANGE("Item No.",'70000');


ItemLedgerEntry.SETRANGE(Open,TRUE);


IF ItemLedgerEntry.FIND('-') THEN;





With Client Monitor on (or using SQL Profiler) you would see the SQL Statement is:





SELECT * FROM "CRONUS International Ltd_$Item Ledger Entry" WITH (READUNCOMMITTED)


WHERE (("Item No_"='70000')) AND (("Open"=1)) AND (("Posting Date"={ts '2007-10-30 00:00:00.000'})) AND (("Lot No_"='HELLO WORLD'))


ORDER BY "Item No_","Open","Variant Code","Positive","Location Code","Posting Date","Expiration Date","Lot No.","Serial No."





Where do you see 'HELLO WORLD'? Which was the first filter applied?





As you could see the driver issues the filters in the order of the key. Actually it does not matter in what order these are in SQL Server either, but that is another story...





The code just looks tidier and nicer if you do it as they suggest, perhaps a really high price for everybody to go through all the "offending" code and correct.



Подробнее... http://dynamicsuser.net/blogs/mark_brummel...lter-order.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 


Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 02:18.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.