Professional Web Applications Themes

I upsized but these SQL statements are causing errors... - ASP Database

OK after all the "get rid of Access" stuff I finally starting upsizing to sql server. However, some of the sql is breaking now. It seems to be my use of stuff like sum(trade) sum(iif(want>0,1,0)) what is the sql server equivalent sql of sum and iif? Thanks, Mike...

  1. #1

    Default I upsized but these SQL statements are causing errors...

    OK after all the "get rid of Access" stuff I finally starting upsizing
    to sql server. However, some of the sql is breaking now. It seems to
    be my use of stuff like

    sum(trade)
    sum(iif(want>0,1,0))

    what is the sql server equivalent sql of sum and iif?

    Thanks,
    Mike
    Mike Guest

  2. #2

    Default Re: I upsized but these SQL statements are causing errors...

    I'm not too sure but according to books online they are usable here is what
    books online says

    SUM
    Returns the sum of all the values, or only the DISTINCT values, in the
    expression. SUM can be used with numeric columns only. Null values are
    ignored.

    Syntax
    SUM ( [ ALL | DISTINCT ] expression )

    Arguments
    ALL

    Applies the aggregate function to all values. ALL is the default.

    DISTINCT

    Specifies that SUM return the sum of unique values.

    expression

    Is a constant, column, or function, and any combination of arithmetic,
    bitwise, and string operators. expression is an expression of the exact
    numeric or approximate numeric data type category, except for the bit data
    type. Aggregate functions and subqueries are not permitted.



    and for iif



    IIf
    Returns one of two numeric or string values determined by a logical test.

    Syntax
    Numeric
    IIf(«Logical Expression», «Numeric Expression1», «Numeric Expression2»)

    This function returns «Numeric Expression1» if «Logical Expression»
    evaluates to TRUE, otherwise returns «Numeric Expression2».

    String
    IIf(«Logical Expression», «String Expression1», «String Expression2»)

    This function returns «String Expression1» if «Logical Expression» evaluates
    to TRUE, otherwise returns «String Expression2».

    check books online for more about these just thought these descriptions
    might help, someone will be able to tell you better if this is no good to
    you


    "Mike" <com> wrote in message
    news:google.com... 


    Steven Guest

  3. #3

    Default Re: I upsized but these SQL statements are causing errors...

    > sum(trade)

    SUM is definitely supported in SQL... How is this "breaking"? Can you
    better define "breaking", e.g. show the actual statement that causes the
    error, and what is the error message?
     

    There is no IIF in the SQL language. Try:

    SUM(CASE WHEN Want>0 THEN 1 ELSE 0 END)

    For some more information see http://www.aspfaq.com/2214

    --
    http://www.aspfaq.com/
    (Reverse address to reply.)


    Aaron Guest

Similar Threads

  1. application.cfm causing internet explorer errors
    By Ignatius in forum Macromedia ColdFusion
    Replies: 0
    Last Post: May 17th, 02:42 PM
  2. Contribute causing office errors
    By xen engineer in forum Macromedia Contribute General Discussion
    Replies: 0
    Last Post: April 4th, 04:04 PM
  3. Flash splash causing errors
    By koolade webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 1
    Last Post: August 1st, 02:55 PM
  4. LsaSrv errors causing account lockout
    By Tony Hargreaves in forum Windows Setup, Administration & Security
    Replies: 0
    Last Post: July 15th, 08:49 AM

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