|
|
|
Странные вещи творятся...
|
|||
|---|---|---|---|
|
#18+
Подскажите, кто сталкивался: запускаю процедуру в QueryAnalyzer - получаю один набор данных, запускаю один в один эту же процедуру в SQL Explorer - получаю совсем другой набор:(( То есть, имеются совпадающие записи, но очень много различий... У меня уже глаза в кучу:(((( В процедуре используется множественная группировка и сортировка на выходе. Вот текст: ---------------------------------------------------------- CREATE PROCEDURE RestsSerg @Date2 datetime, @Sklads varchar(200) AS select @Sklads = ','+ltrim(rtrim(@Sklads))+',' select t.code tovar,ta.code tara, Coalesce(tf.qtara , 1) qtara , sum(case when (s.prim_code=16) or (s.prim_code=17 and (charindex(','+rtrim(ltrim(str(s.skl_code2)))+',', @Sklads )>0) ) then (tf.quantity/(Coalesce(tf.qtara , 1)*case when m.sign =1 then ta.amount else 1 end)) else (-1*(tf.quantity/(Coalesce(tf.qtara , 1)*case when m.sign =1 then ta.amount else 1 end))) end) Mest, sum(case when (s.prim_code=16) or (s.prim_code=17 and (charindex(','+rtrim(ltrim(str(s.skl_code2)))+',', @Sklads )>0) ) then (case when m.sign =1 then tf.quantity else tf.quantity*ta.amount end) else (-1*(case when m.sign =1 then tf.quantity else tf.quantity*ta.amount end )) end) Ves, sum(case when (s.prim_code=16) or (s.prim_code=17 and (charindex(','+rtrim(ltrim(str(s.skl_code2)))+',', @Sklads )>0) ) then tf.quantity* tf.buyprice else -1*tf.quantity* tf.buyprice end) summa, t.name tovarname,ta.name taraname, tf.buyprice, tech.name techname, ts.name vidname, tf.tech_code, tf.vid_code, ta.amount from shapka_firm s, tovar t, telo_firmm tf left join tara ta on tf.tara_code = ta.code left join measure m on tf.measure_code = m.code left join technologis tech on tf.tech_code = tech.code left join tovar_subgr ts on tf.vid_code = ts.code where ((s.constrsign =1 and s.prim_code=1 and s.date_doc >= "03.01.2002" ) or s.prim_code in( 3, 16, 17) ) and s.code = tf.code and tf.tov_code = t.code and s.date_doc <= @Date2 and ((charindex(','+rtrim(ltrim(str(s.skl_code)))+',', @Sklads )>0) or (charindex(','+rtrim(ltrim(str(s.skl_code2)))+',', @Sklads )>0) ) and not ((charindex(','+rtrim(ltrim(str(s.skl_code)))+',', @Sklads )>0) and (charindex(','+rtrim(ltrim(str(s.skl_code2)))+',', @Sklads )>0) ) group by t.code, ta.code, Coalesce(tf.qtara , 1), ta.amount, t.name ,ta.name, tf.tech_code, tf.vid_code, tech.name , ts.name, tf.buyprice having sum(case when (s.prim_code=16) or (s.prim_code=17 and (charindex(','+rtrim(ltrim(str(s.skl_code2)))+',', @Sklads )>0) ) then (tf.quantity/(tf.qtara*case when m.sign =1 then ta.amount else 1 end)) else (-1*(tf.quantity/(tf.qtara*case when m.sign =1 then ta.amount else 1 end))) end)<>0 order by t.name,ta.name GO ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.06.2002, 12:26:56 |
|
||
|
Странные вещи творятся...
|
|||
|---|---|---|---|
|
#18+
Попробовал через АДО - результат аналогичен QueryAnalyzer. Неужели это БДЕ-шные глюки??!! ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.06.2002, 12:35:32 |
|
||
|
Странные вещи творятся...
|
|||
|---|---|---|---|
|
#18+
более того, я вытащил просто запрос как текст, выполнил его в Analyzer и в SQL Explorer - один черт, получаю разные результаты, причем конкретно разные......... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.06.2002, 13:40:28 |
|
||
|
Странные вещи творятся...
|
|||
|---|---|---|---|
|
#18+
Есть одна мысль... Только (прошу прощения за тупость) что есть SQL Explorer и откуда запускается? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.06.2002, 14:00:17 |
|
||
|
Странные вещи творятся...
|
|||
|---|---|---|---|
|
#18+
Я тоже столкнулся с тем что процедура, выполненая через PHP (там стоит Unix) работает не так. У меня по ходу процедуры во временных таблицах пропадали записи если в каким-нибудь поле саделжался null. Использовались, как очевидно и у Вас, старые библитеки от 6.5, скорее всего в этом и причина. Но мне это как-то непонятно - ладно если б совсем не работало... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.06.2002, 14:55:20 |
|
||
|
|

start [/forum/topic.php?fid=46&msg=32033193&tid=1822285]: |
0ms |
get settings: |
10ms |
get forum list: |
18ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
56ms |
get topic data: |
13ms |
get forum data: |
3ms |
get page messages: |
61ms |
get tp. blocked users: |
2ms |
| others: | 219ms |
| total: | 388ms |

| 0 / 0 |
