help syntax problem

HanneyHanney Member Posts: 41
edited 2008-12-31 in SQL General
Hi there,
In navision table Detailed Vendor Ledg. Entry
field name:Doc type-option,
In properties: Option string:,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund

when i select doc type using sql like this:
select doc type from Detailed Vendor Ledg. Entry

it will display result:
doc type
1
2
3

has anybody have an idea how to display data like this:
doc type
payment
invoice
credit memo

thank you..

Comments

  • garakgarak Member Posts: 3,263
    as i know in T-SQL Arrays are not possible.
    @tmpTable and fill this temp table and make then a join in the select.

    A other (fast) is a the following
    SELECT [Entry No_]
          ,[Vendor Ledger Entry No_]
          ,[Entry Type]
          ,[Posting Date]
          ,[Document Type] = 
    		CASE 
              WHEN [Document Type] = 0 THEN 'BLANK'
              WHEN [Document Type] = 1 THEN 'Payment'
              WHEN [Document Type] = 2 THEN 'Invoice'
    		  WHEN [Document Type] = 3 THEN 'Credit Memo'
    		  WHEN [Document Type] = 4 THEN 'Finance Charge Memo'
    		  WHEN [Document Type] = 5 THEN 'Reminder'
    		  WHEN [Document Type] = 6 THEN 'Refund'
    		  ELSE 'WARNING NOT DEFINED'
    		end
          ,[Document No_]
      FROM [DATABASEName].[dbo].[COMPANY$Detailed Vendor Ledg_ Entry]
    

    Maybe it's also possible with a varchar variable and then with cast() and convert() and the IN() method. But i doesn't know this way.....

    Regards
    Do you make it right, it works too!
  • HanneyHanney Member Posts: 41
    Thank you..its really help.. \:D/
  • garakgarak Member Posts: 3,263
    Please and welcome
    Do you make it right, it works too!
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    @garak: Congrats with your birthday!
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • garakgarak Member Posts: 3,263
    @Luc: Thanks
    Do you make it right, it works too!
Sign In or Register to comment.