--StorageGoodsInfo 库存余额表
--字段名 字段类型 是否为空 字段说明 关联表名
create table StorageGoodsInfo(
PtypeId int Not null, --商品ID(K3为varchar) 
KtypeId int Not null ,--仓库ID(K3为varchar) 
JobNumber Varchar(20) Not null, --商品批号 
OutFactoryDate Varchar(13) Not null, --生产日期 
Qty Numeric(22,8) Not null, --基本单位数量 
Price Numeric(22,8) Not null, --成本单价 
Total Numeric(22,4) Not null, --成本金额 
GoodsOrder int Not null, --产品批次 
GOODSORDERID int Not null, --标识列 
CropID int Not null --分支机构ID 
)--BasStockInner 仓库信息表
--字段名 字段类型 是否为空 字段说明 关联表名
create table BasStockInner(
BaseNo int Not null,-- 主键标识字段PK 
ParentNo int Not null,-- 父类ID 
BaseLevel smallint Not null,-- 信息层级数 
SonNum int Not null,-- 儿子数 
BasePath Varchar(100) Not null,-- 信息分类路径 
FullName Varchar(66) Not null,-- 仓库全名 
Name Varchar(30) Not null,-- 仓库简名 
BaseCode Varchar(26) Not null,-- 仓库编号 
Memo Varchar(256) Not null,-- 备注 
deleted bit Not null,-- 删除标记 
PyNo Varchar(66) Not null,-- 拼音码 
ROWINDEX int Not null,-- 信息排序字段 
StType bit Not null,-- 仓库类型(ERP不用) 
Stoped bit Not null,-- 信息停用标识 
CropId int Not null --分支机构ID 
)--BasPtypeInner 商品信息表
--字段名 字段类型 是否为空 字段说明 关联表名
create table BasPtypeInner(
BaseNo int Not null,-- 主键标识列PK 
ParentNo int Not null,-- 父类ID 
BaseLevel int Not null,-- 信息层级数 
SonNum int Not null,-- 儿子数 
SonCount int Not null,-- 曾经拥有的儿子数 
BasePath Varchar(100) Not null,-- 信息分类路径 
BaseCode Varchar(30) Not null,-- 商品编号 
Name Varchar(100) Not null,-- 商品简名 
FullName Varchar(100) null,-- 商品全称 
Standards Varchar(50) null,-- 商品规格 
Model Varchar(50) null,-- 商品型号 
ProArea Varchar(50) null,--商品产地 
BasicUnit Varchar(10) Not null,-- 基本单位 
AssistUnitOne Varchar(10) null,-- 辅助单位一 
AssistUnitTwo Varchar(10) null,-- 辅助单位二 
AssistUnitThree Varchar(10) null,-- 辅助单位三 
SalePriceBasic Numeric(22,8) Not null,-- 基本单位零售价 
SalePriceOne Numeric(22,8) Not null,-- 辅助单位一零售价 
SalePriceTwo Numeric(22,8) Not null,-- 辅助单位二零售价 
SalePriceThree Numeric(22,8) Not null,-- 辅助单位三零售价 
PercentBasic Numeric(22,8) null,-- 基本单位换算率 
PercentOne Numeric(22,8) Null,-- 辅助单位一换算率 
PercentTwo Numeric(22,8) Null,-- 辅助单位二换算率 
PercentThree Numeric(22,8) null,-- 辅助单位三换算率 
UseFullLifeDay int null,-- 保质期天数 
RecentPrice Numeric(22,8) null,-- 最近进价(基本单位) 
RecentPrice1 Numeric(22,8) null-- 最近进价(条码默认单位) 
)希望得到某件商品在仓库表中的数量,有库存的话就直接显示数量,没有的话就为空,听说要用游标,请高手指点。