Solved

Interactive 'WITH' Statement

Posted on 2009-05-14
2
186 Views
Last Modified: 2012-05-07
Sample code not working and I don't see why.  Any suggestions?
Token ( was not valid. Valid tokens: FOR WITH FETCH ORDER UNION EXCE 
 WITH MYTABLE AS (SELECT DDCREW, DDDRV#,                              
   DATE(DDYEAR || DDMOTH || DDDAY) As strdate, ddmd from cdsddm)      
 select * from MYTABLE                                                
   where dddrv#=2523                                                  
    and strdate = 20090316

Open in new window

0
Comment
Question by:lynn_harris
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
Dave Ford earned 50 total points
ID: 24390015

Since my date-format is *ISO, the following works for me:

WITH MYTABLE AS (
  SELECT 2523 as DDDRV#,
         DATE('2009' || '-' || '03' || '-' || '16') As strdate
  from   sysibm/sysdummy1)
select *
from   MYTABLE
where  dddrv#=2523
  and  strdate = '2009-03-16'
 
HTH,
DaveSlash

Open in new window

0
 

Author Closing Comment

by:lynn_harris
ID: 31581707
Thank You.  I will toy with my some more.  
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question