Can I use a CTE in my SQL that I keep as a text file and use the RUNSQLSTM to execute?

10 pts.
Tags:
SQL; RUNSQLSTM
with yearweek as (                                      
    SELECT *                                            
       from (select deoyear1,deoweek1,                  
             row_number() over (order by deoyear1       
             desc,deoweek1 desc)  as rn                 
          FROM delib.DEPOSTEDO                          
       ) as r                                           
            where r.rn <= 24  )                         
                                                        
select * from dedt d                                    
   join yearweek yw                                     
     on deoyear1 = dtyear and deoweek1 = dtweek         
   order by dtyear, dtweek, dtcos#;                     
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    What are you trying to do? There may be more efficient ways but we need more details as to why you chose this method.

    131,625 pointsBadges:
    report
  • TheRealRaven
    A CTE isn't executable by itself; it needs at least a SELECT to make use of it. It's not clear what you're asking. Can you clarify what you need to do? I.e., what problem are you trying to solve?
    34,465 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: