在輸入供應商編碼后,需要判斷該供應商是否屬于權限門店,寫動態sql
s_sql='select sup_code,sup_desc,man_type,cont_code,founded_time,determine_timecen_person,stat_flag,abc_class from supplier where sup_code="'+supcode+'" and shop_own in ('+ls_shop+')'
declare cur_shop dynamic cursor for sqlsa;
prepare sqlsa from :ls_sql;
open dynamic cur_shop;
fetch cur_shop into :supcode,:supdesc,:mantype,:contcode,:foundeddate,:determinedate,:enrolperson,:statflag,:abcclass;
close cur_shop;
lS_shop是我已經做好的門店字串,但是發現不在該門店的供應商也能查出來
用sqlserver事件查看器跟蹤了一下,代碼如下:
declare @P1 int
set @P1=0
declare @P2 int
set @P2=2
declare @P3 int
set @P3=0
exec sp_cursoropen @cursor = @P1 output, @stmt = 'select sup_code,sup_desc,man_type,cont_code,founded_time,determine_timecen_person,stat_flag,abc_class from supplier where sup_code="80381" and shop_own in ("002","003","004","005","006")', @scrollopt = @P2 output, @ccopt = 4, @rows = @P3 output
select @P1, @P2, @P3
80381供應商是門店001的,也就是不在in條件下的任何一個門店,為什么還會查出來呢?
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/239728.html
標籤:腳本語言
下一篇:tb級表齡清理
