Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare @autoid varchar(7000)='1000907958', -- M-CCFD201030 1115-RD-0057
- @keyfield nvarchar(60)='autoid',
- @tablename nvarchar(60)='rdrecords08',
- @cUserId nvarchar(20)='demo';
- exec('
- select max(cinvcode),max(cbatch),max(cfree1),max(cfree2),max(cfree3),max(cfree4),max(cfree5),max(cfree6),max(cfree7),max(cfree8),max(cfree9),max(cfree10),max(cBatchProperty1),max(cBatchProperty2),max(cBatchProperty3),max(cBatchProperty4),max(cBatchProperty5),max(cBatchProperty6),max(cBatchProperty7),max(cBatchProperty8),max(cBatchProperty9),max(cBatchProperty10)
- from '+ @tablename +'
- inner join inventory_sub
- on ' + @tablename+'.cinvcode=inventory_sub.cinvsubcode
- where ' + @keyfield + ' in (' + @autoid + ') and isnull(inventory_sub.bbatchcreate,0)=1 and isnull(cbatch,'''')<>''''
- group by cinvcode,cbatch,cfree1,cfree2,cfree3,cfree4,cfree5,cfree6,cfree7,cfree8,cfree9,cfree10
- ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement