Professional Web Applications Themes

IF statment wont work - Microsoft SQL / MS SQL Server

What is the error or behaviour you are getting? "JR" <nonenone.net> wrote in message news:055c01c33ee2$68b8ac10$a501280aphx.gbl... > Who wont this if statments work? The server say that the > syntax is correct, but when i run the stored p. he adds > the: > SELECT sSQL = sSQL + ... > > but the variables have the "- Valfritt -" value > > (typ_av_dator = "- Valfritt -") > > SQL > > > IF ((typ_av_dator <> "- Valfritt -") OR (typ_av_dator > <> '')) > BEGIN > SELECT sSQL = sSQL + ' AND > (dator.typ_av_dator = "' + typ_av_dator ...

  1. #1

    Default Re: IF statment wont work

    What is the error or behaviour you are getting?
    "JR" <nonenone.net> wrote in message
    news:055c01c33ee2$68b8ac10$a501280aphx.gbl...
    > Who wont this if statments work? The server say that the
    > syntax is correct, but when i run the stored p. he adds
    > the:
    > SELECT sSQL = sSQL + ...
    >
    > but the variables have the "- Valfritt -" value
    >
    > (typ_av_dator = "- Valfritt -")
    >
    > SQL
    >
    >
    > IF ((typ_av_dator <> "- Valfritt -") OR (typ_av_dator
    > <> ''))
    > BEGIN
    > SELECT sSQL = sSQL + ' AND
    > (dator.typ_av_dator = "' + typ_av_dator + '" ) '
    > END
    >
    > IF ((cpu_modell <> "- Valfritt -") OR (cpu_modell <> ''))
    > BEGIN
    > SELECT sSQL = sSQL + ' AND
    > (cpu.cpu_modell = "' + cpu_modell + '" ) '
    > END
    >
    > IF ((cpu_mhz <> "- Valfritt -") OR (cpu_mhz <> ''))
    > BEGIN
    > SELECT sSQL = sSQL + ' AND (ut.cpu_mhz '
    > + cpu_mhz + ' ) '
    > END
    >
    > Sorry for my poor english
    > /JR

    Wayne Snyder Guest

  2. #2

    Default Re: IF statment wont work

    Hi

    As you are using the OR clause then if the second part of the condition is
    met the first may not be met, but overall it will be TRUE.

    Maybe you require AND?

    John


    "JR" <nonenone.net> wrote in message
    news:055c01c33ee2$68b8ac10$a501280aphx.gbl...
    > Who wont this if statments work? The server say that the
    > syntax is correct, but when i run the stored p. he adds
    > the:
    > SELECT sSQL = sSQL + ...
    >
    > but the variables have the "- Valfritt -" value
    >
    > (typ_av_dator = "- Valfritt -")
    >
    > SQL
    >
    >
    > IF ((typ_av_dator <> "- Valfritt -") OR (typ_av_dator
    > <> ''))
    > BEGIN
    > SELECT sSQL = sSQL + ' AND
    > (dator.typ_av_dator = "' + typ_av_dator + '" ) '
    > END
    >
    > IF ((cpu_modell <> "- Valfritt -") OR (cpu_modell <> ''))
    > BEGIN
    > SELECT sSQL = sSQL + ' AND
    > (cpu.cpu_modell = "' + cpu_modell + '" ) '
    > END
    >
    > IF ((cpu_mhz <> "- Valfritt -") OR (cpu_mhz <> ''))
    > BEGIN
    > SELECT sSQL = sSQL + ' AND (ut.cpu_mhz '
    > + cpu_mhz + ' ) '
    > END
    >
    > Sorry for my poor english
    > /JR

    John Bell Guest

Similar Threads

  1. Wont Work
    By THERSOfi in forum Macromedia Flash Player
    Replies: 1
    Last Post: October 22nd, 10:29 AM
  2. SQL wont work
    By MalRom in forum Macromedia Dynamic HTML
    Replies: 1
    Last Post: December 22nd, 11:03 AM
  3. Sound wont work
    By Zoboda webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 1
    Last Post: October 27th, 10:42 AM
  4. Can anyone tell me why this wont work
    By Creative Acceleration in forum Macromedia Director Lingo
    Replies: 7
    Last Post: September 3rd, 07:12 PM
  5. Can anyone tell me why this wont work??
    By Scott D in forum PHP Development
    Replies: 5
    Last Post: July 10th, 07:54 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