I have a variable called @.ORComm which has been selected using a cursor from each line on an order.
DECLARE TC2 CURSOR FOR
SELECT [Commodity],[Total] FROM [CSITSS].[dbo].[Ordrate] WHERE [OrderNumber]= @.OrdNum AND [Companydiv] = 'GLPC-TRANS'
OPEN TC2
FETCH NEXT FROM TC2 INTO @.ORComm, @.ORTotal
I need to compare the resulting @.ORComm against a list of valid commodity types selectable by
SELECT [CommodityClass] FROM [CSITSS].[dbo].[Comclass] WHERE [CompanyDiv] = 'GLPC-TRANS' AND [DELETED] = 0
What's the easiest way to do this?SELECT [CommodityClass] FROM [CSITSS].[dbo].[Comclass] WHERE [CompanyDiv] = 'GLPC-TRANS' AND [DELETED] = 0 and CommodityClass=@.ORComm
??|||I feel stupid I didn't think of that. I was thinking of storing the selected values in an array but that is much simpler.
Showing posts with label cursor. Show all posts
Showing posts with label cursor. Show all posts
Friday, March 23, 2012
Subscribe to:
Posts (Atom)