Comma-delimited Output
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Comma-delimited Output

  1. #1
    Join Date
    Jul 2004
    Location
    South Africa
    Posts
    71

    Angry Comma-delimited Output

    Hi All,

    I have attached two documents that I need help with. The one is the script that I have written to access data and the other is the view structure that i want to access data from. The problem is that I'm working is SQL2000 and I want to print a card for the street trader. The street trader is selling more than one product, when I try to print the card for one trader it prints as many cards as the products that he's selling. What can I do, to make sure that it prints only one card.
    Attached Files Attached Files

  2. #2
    Join Date
    Apr 2002
    Location
    Egypt
    Posts
    2,209

    Re: Comma-delimited Output

    The attachments don't explain everything, (what is the [dbo].[findstandbyidno] table?)
    Anyway, why is (WHERE [rent] = @rentID) commented?
    Hesham A. Amin
    My blog , Articles


    <a rel=https://twitter.com/HeshamAmin" border="0" /> @HeshamAmin

  3. #3
    Join Date
    Feb 2008
    Location
    Bangalore
    Posts
    149

    Re: Comma-delimited Output

    Alter your function dbo.[ufn_Getdescription] as below

    Code:
    
    CREATE FUNCTION [dbo].[ufn_Getdescription] ( @rentID INT )
    RETURNS VARCHAR(8000)
    AS
    BEGIN
    
    DECLARE @Descriptions            VARCHAR(8000)
    Declare @Desc  Valrchar(50)
    
    Declare TmpCur For select [Description] From findstandbyidno where rent = @rentID
    Open TmpCur
    Fetch Next from TmpCur Into @Desc
    Begin
       if @desc is not null
         set @Descriptions=@Descriptions + Case when @Descriptions='' then '' else ',' end + @Desc
    Fetch Next from TmpCur Into @Desc
    End
    close tmpcur
    Deallocate tmpcur
    RETURN @Descriptions 
    END
    Encourage the efforts of fellow members by rating

    Lets not Spoon Feed and create pool of lazy programmers

    - ComIT Solutions

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center