Andrew Peterson wrote:
> Hi,
> 
> I'd like to see how this is done, even though it is not necessary and I like 
> my ColdFusion thank you very much. Can someone give me a general idea of how 
> this code would look in SQL Server? It takes literally 5 minutes to write in 
> CF; but for me to put it into a SQL Server stored procedure I'm lost. Here's 
> the code.
> 
> <cfquery datasource="#request.dsn#" name="qryLooper">
> SELECT RecordType FROM LHF_Line 
> where quarter = '#lastQuarter#'
> </cfquery>
>       
> <cfloop query="qryLooper">
>    <cfif recordtype eq "MC" or recordtype eq "NA">
>       <CFQUERY DATASOURCE="#request.dsn#">
>       INSERT INTO LHF_Line...abc
>       </CFQUERY>      
>    <cfelse>
>       <CFQUERY DATASOURCE="#request.dsn#">
>       INSERT INTO LHF_Line...def
>       </CFQUERY>
>    </cfif>
> </cfloop>
> 

I'm not quite sure where the ...abc and ...def data is going to come 
from, but possibly something like this would work...

CREATE PROC spThisProc @qrtr varchar(50) AS

INSERT INTO LHF_Line(...abc)
SELECT ...abc FROM LHF_Line WHERE quarter = @quarter AND recordtype IN 
('MC','NA')

INSERT INTO LHF_Line(...def)
SELECT ...def FROM LHF_Line WHERE quarter = @quarter AND recordtype NOT 
IN ('MC','NA')

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:272688
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to