1.部署IIS
2.将图片以商品编号方式命名,并存在到IIS对应的目录下
3.执行脚本,批量插入图片,对商品资料档案建立关联
--特别说明1:具体客户请注意替换cPictureUrl值:http://61.187.98.58:10088
--特别说明2:具体客户请注意替换函数参数值:D:PurSunPictureAsstAlbumImg
--************只有在本机才有权限访问路径,一定要在数据库服务器上运行。************
--1.到款号
INSERT INTO InventoryPicture
(cInvCode, cColorCode, pPicture, cPictureUrl, cPictureDesc, cHandle, bDefault, dCreateDate)
SELECT cInvCode, cColorCode ='', pPicture= ''
, cPictureUrl = 'http://61.187.98.58:10088/Asst/Album/Img/' +cInvCode +'.jpg'
, cPictureDesc = ''
, cHandle = CEILING(rand(checksum(newid()))*100000)
, bDefault = 0
, dCreateDate = convert(varchar(16),getdate(),120)
FROM Inventory
WHERE cInvCode NOT IN (SELECT cInvCode FROM InventoryPicture)
AND dbo.fSYS_ExistFile('D:PurSunPictureAsstAlbumImg' +cInvCode +'.jpg') = 1
--2.到款号+色号
INSERT INTO InventoryPicture
(cInvCode, cColorCode, pPicture, cPictureUrl, cPictureDesc, cHandle, bDefault, dCreateDate)
SELECT cInvCode, cColorCode, pPicture= ''
, cPictureUrl = 'http://61.187.98.58:10088/Asst/Album/Img/' +cInvCode +'@' +cColorCode + '.jpg'
, cPictureDesc = ''
, cHandle = CEILING(rand(checksum(newid()))*100000)
, bDefault = 0
, dCreateDate = convert(varchar(16),getdate(),120)
FROM InventoryColor
WHERE cInvCode + cColorCode NOT IN (SELECT cInvCode + cColorCode AS cInvColorCode FROM InventoryPicture)
AND dbo.fSYS_ExistFile('D:PurSunPictureAsstAlbumImg' +cInvCode +'@' +cColorCode + '.jpg') = 1
4.在商品料档案下,查看是商品是否已上图