Professional Web Applications Themes

format a COMPUTE BY clause - Microsoft SQL / MS SQL Server

Lam, What do you mean by "the COMPUTE BY clause won't compute if I formatted the field". Can you show an example of what you're trying to do. We'll see if we can help. -- -oj RAC v2.2 & QALite! http://www.rac4sql.net "LamP" <com> wrote in message news:060d01c350a9$bb67e830$gbl... ...

  1. #1

    Default Re: format a COMPUTE BY clause

    Lam,

    What do you mean by "the COMPUTE BY clause won't compute if I formatted the
    field". Can you show an example of what you're trying to do. We'll see if we
    can help.

    --
    -oj
    RAC v2.2 & QALite!
    http://www.rac4sql.net


    "LamP" <com> wrote in message
    news:060d01c350a9$bb67e830$gbl... 


    oj Guest

  2. #2

    Default Re: format a COMPUTE BY clause

    Example:
    SELECT StuID, Sname, amount --CONVERT(VARCHAR(12),amount)
    FROM Loan
    ORDER BY StudID
    COMPUTE SUM(amount) BY code

    this select statement works fine. However, if I try to
    format the amount field, it will error out with
    message: "COMPUTE clause #1, aggregate expression #1 is
    not in the select list."

    Thanks,
    LamP 
    if I formatted the 
    do. We'll see if we [/ref]
    BY 
    >
    >
    >.
    >[/ref]
    LamP Guest

  3. #3

    Default Re: format a COMPUTE BY clause

    Compute is used to perform an aggregate function. You cannot do sum() on
    varchar/str datatype. This is by design.

    --
    -oj
    RAC v2.2 & QALite!
    http://www.rac4sql.net


    "LamP" <com> wrote in message
    news:069e01c350b1$b7580ba0$gbl... 
    > if I formatted the 
    > do. We'll see if we [/ref]
    > BY 
    > >
    > >
    > >.
    > >[/ref][/ref]


    oj Guest

  4. #4

    Default Re: format a COMPUTE BY clause

    Numeric formatting should usually be a client-side process.

    COMPUTE and COMPUTE BY are deprecated features. Use either CUBE/ROLLUP or
    multiple SELECT statements instead.

    --
    David Portas
    ------------
    Please reply only to the newsgroup
    --

    "LamP" <com> wrote in message
    news:060d01c350a9$bb67e830$gbl... 


    David Guest

Similar Threads

  1. How do I get 'COMPUTE' output
    By David P. Jessup in forum ASP Database
    Replies: 2
    Last Post: November 10th, 04:58 PM
  2. New FAQ: How do I compute the difference of two arrays?
    By The in forum PERL Miscellaneous
    Replies: 9
    Last Post: September 29th, 09:10 PM
  3. ASP + SQL2000 : request with COMPUTE SUM(xx)
    By Bryce in forum ASP Database
    Replies: 1
    Last Post: September 22nd, 04:35 PM
  4. Replies: 1
    Last Post: July 28th, 05:36 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139