Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2007
    Posts
    33

    Question Unanswered: IDIOT NEEDS HELP comparing a variable against a list

    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?

  2. #2
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    SELECT [CommodityClass] FROM [CSITSS].[dbo].[Comclass] WHERE [CompanyDiv] = 'GLPC-TRANS' AND [DELETED] = 0 and CommodityClass=@ORComm

    ??

  3. #3
    Join Date
    Feb 2007
    Posts
    33

    Thanks

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •