exec sp_addlinkedserver
@server = 'access',
@provider = 'Microsoft.Jet.OLEDB.4.0',
@srvproduct = 'OLE DB Provider for Jet',
@datasrc = 'C:/Inetpub/wwwroot/jasmine/packinglist/20051221pk-bridal.mdb'
exec ('sp_addlinkedsrvlogin ''access'', ''false'' ')
exec( ' select count( a.styleid) YCount ,a.styleid ,(select count(*) JCount from stylecode b with (nolock) where b.styleid=a.styleid and b.prodline in (select prodlineid from prodline with (nolock) where prodkind=0) ) JCount from OPENQUERY(access, ''select styleid from suppacklistcart'') a group by a.styleid order by JCount ')
EXEC sp_droplinkedsrvlogin 'access', NULL
exec sp_dropserver 'access'