I do believe this should work,

IF LEN(@Union_ID)
        BEGIN
                AND Sup_Service_Union.Union_ID = @Union_ID
                AND Sup_Service_Union.Service_ID = Sup_Service.Service_ID
        END

>>On that note what's the consensus on using case statements like this 
in
stored procs vs. a
>>different stored proc for each case?

I suppose If your conditions are immense then it would be a good idea, 
but I
haven't done it.
I know SQL server 2000 there are UDF's I think you can write your own, 
I'm
not sure if UDF's existed in sql 7.0, which is what we use, but you
certainly can call stored procs from within stored procs.

Performance benefits I'd say would be about the same, but its a good 
may to
modularise code that may be called by more than one stored proc.

There is a really good book on all of this,

by Gareth Wells
http://www.amazon.com/exec/obidos/ASIN/1893115836/qid%3D1013594517/sr%3D
1-2/
ref%3Dsr%5Fsp%5Fre/102-1325350-7422549

J

John McCosker (Senior Web Applications Developer)
Andronics Data Global Communications
Derry, Co.Londonderry
N.Ireland
Bt48 OLY

Tel +44(0)28 7127 3100
Fax +44(0)28 7127 3101


-----Original Message-----
From: Bryan Stevenson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 9:14 PM
To: CF-Talk
Subject: Case Statements in SQL Server Stored Procs


Hey All,

Looking for the lingo to do case statements in SQL Server stored 
procedures.

So I want to mirror this:

  <cfif len(qOrderRules.Union_ID)>
    AND Sup_Service_Union.Union_ID = #qOrderRules.Union_ID#
    AND Sup_Service_Union.Service_ID = Sup_Service.Service_ID
  </cfif>

in the WHERE clause of the stored proc. (lets assume I pass a param to 
the
stored proc called
@Union_ID)

On that note what's the consensus on using case statements like this in
stored procs vs. a different
stored proc for each case?

TIA

Bryan Stevenson
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
p. 250.920.8830
e. [EMAIL PROTECTED]
---------------------------------------------------------
Macromedia Associate Partner
www.macromedia.com
---------------------------------------------------------
Vancouver Island ColdFusion Users Group
Founder & Director
www.cfug-vancouverisland.com


______________________________________________________________________
Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to