Re: Dynamic WHERE statement

From: Jim Warren (jmwarren_at_msu.edu)
Date: 01/29/05


Date: Fri, 28 Jan 2005 19:19:41 -0500

Sorry about that, it was a very long day, about 2pm time slowed noticeably
"Admiral Q" <Star_Fleet_Admiral_Q(NOSPAM)@(SPAMNOT)hotmail.com> wrote in
message news:u4$W1bZBFHA.1400@TK2MSFTNGP11.phx.gbl...
> In case you haven't figured it out, this is a "windows XP setup and
> deployment group" and not a "how to code SQL2k group". Your best bet is
> to
> repost in one of the many SQL newsgroups for the "gurus" there to answer
> your question. ;-)
>
> --
> Star Fleet Admiral Q @ your service!
>
>
> "Jim Warren" <jmwarren@msu.edu> wrote in message
> news:uRdZFGZBFHA.936@TK2MSFTNGP12.phx.gbl...
>> If I pass a variable to @Cost_Center that is 'SMS', 'SMP' OR 'ALL'
>> 'ALL' will return records that have either 'SMS' or 'SMP' in them.
>> Now I am using an if statement that has the entire SQL statement in the
> body
>> of the
>> conditional.
>>
>> I tried this
>>
>> Where
>>
>> IF (@Cost_Center = 'All')
>>
>> Begin
>>
>> code...
>> and i.cost_center in ('SMS','SMP')
>>
>> End
>>
>> ELSE
>>
>> Begin
>>
>> code...
>> and i.cost_center = @Cost_Center
>>
>> End
>>
>>
>> Thanks
>> Jim
>>
>>
>
>



Relevant Pages

  • Re: Scheduled Bootup
    ... "Jim" wrote in message ... > Is it possible to setup my windows pc to bootup at a ...
    (microsoft.public.windowsxp.general)
  • Re: reorder columns in a gridview
    ... Change column order in the sql statement that gets the data. ... Software Developer ... Microsoft MVP ... and in a windows application I can use ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Error : Item not found in this collection
    ... > Dim db As DAO.Database ... FIrst, the SQL statement for = date, the result needs to be ... If neither of these fixes the current problem, then post back with the line ... Jim C. ...
    (microsoft.public.access.queries)
  • Re: ADODataset: Query parameter used twice in the SQL satatement
    ... > Hi Jim, ... > You don't specify how you are setting the value of the parameter, ... > assuming you are using the 'ParamByName' method. ... > they are separate and distinct objects within the SQL statement. ...
    (borland.public.delphi.database.ado)
  • Re: $sql = "update products set smallpicname = $myfile .....????
    ... Jim S. wrote: ... i tried your suggestion and it did not work. ... i want the value of $myfile to be in the $sql, but it is not doing it, ... how can i put variables in the $sql statement so i can execute it with ...
    (comp.lang.php)