Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7188611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:07:19+00:00 2026-05-28T19:07:19+00:00

UPDATE: Thanks for all your help guys! I just need to take a litte

  • 0

UPDATE: Thanks for all your help guys! I just need to take a litte bit of time to tlook through the results and I will definitely mark the answer. Really appreciate everyone’s feedback!

I have the following query that needs to be converted from Oracel PL/SQL to T-SQL to accomodate a data source change. I’ve already done the work needed to isolate the logic (still written in PL/SQL) and merely need to adjust the remaining parts. Things like TO_DATE have, in particular, been tricky to convert so I decided to turn to StackOverflow.

I have already heard about the SwisSQL tool but as this is just an isolated instance of a single query that needs conversion using that product in not a possibility. Any and all help in converting the query to use proper T-SQL synthax would be greatly appreciated. Thank you for your time and here’s the query in question:

 SELECT
            F.TYPE_ID,
            TRIM(f.event_type_name),
            TRIM(e.event_name),
            NVL(trim(e.event_title),' '),
            e.cur_event_state,
            TO_CHAR(D.EV_START_DT, 'YYYYMMDD') ,
            TO_CHAR(D.EV_START_DT,'HH24MI') ,
            TO_CHAR(D.EV_END_DT, 'YYYYMMDD') ,
            TO_CHAR(D.EV_END_DT,'HH24MI') ,
            TO_char(d.EV_START_DT, 'D')
    from rooms C,
         SP_RESERVATIONS D,
         EVENTS E,
         event_types f
    where @Room = TRIM(replace(C.room_short(+),'-','*'))
AND C.ROOM_ID = D.ROOM_ID
      AND D.EVENT_ID = E.EVENT_ID
      and e.event_type_id = f.type_id
      and f.type_id in ('22','40','70','71','72','105','121','119')
      AND (D.EV_START_DT
                     BETWEEN TO_DATE(:WS-TERM-START-DATE,'YYYYMMDD')
                        AND TO_DATE(:WS-TERM-END-DATE,'YYYYMMDD')
       OR  D.EV_END_DT
                     BETWEEN TO_DATE(:WS-TERM-START-DATE,'YYYYMMDD')
                        AND TO_DATE(:WS-TERM-END-DATE,'YYYYMMDD'))
      and not e.cur_event_state = '59'

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:07:20+00:00Added an answer on May 28, 2026 at 7:07 pm

    Ok, try this query:

    SELECT f.type_id, 
           LTRIM(RTRIM(f.event_type_name)), 
           LTRIM(RTRIM(e.event_name)), 
           ISNULL(LTRIM(RTRIM(e.event_title)), ' '), 
           e.cur_event_state, 
           CONVERT(VARCHAR(8), d.ev_start_dt, 112), 
           CONVERT(VARCHAR(5), d.ev_start_dt, 114), 
           CONVERT(VARCHAR(8), d.ev_end_dt, 112), 
           CONVERT(VARCHAR(5), d.ev_end_dt, 114), 
           DATENAME(DAY, d.ev_start_dt) 
    FROM   rooms c 
           INNER JOIN sp_reservations d 
             ON c.room_id = d.room_id 
           INNER JOIN [EVENTS] e 
             ON d.event_id = e.event_id 
           INNER JOIN event_types f 
             ON e.event_type_id = f.[type_id] 
    WHERE  @Room = RTRIM(LTRIM(REPLACE(c.room_short, '-', '*'))) 
           AND f.[type_id] IN ( '22', '40', '70', '71', 
                                '72', '105', '121', '119' ) 
           AND ( d.ev_start_dt BETWEEN CONVERT(DATETIME, [WS-TERM-START-DATE], 112) 
                                       AND 
                                             CONVERT(DATETIME, [WS-TERM-END-DATE], 
                                             112) 
                  OR d.ev_end_dt BETWEEN CONVERT(DATETIME, [WS-TERM-START-DATE], 112 
                                         ) AND 
                                             CONVERT(DATETIME, [WS-TERM-END-DATE], 
                                             112) ) 
           AND NOT e.cur_event_state = '59' 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thanks for all your help, I now have add, update, and delete functions on
UPDATE 2: Thanks so much for all your help. While all three solutions worked,
(More package/component install fun for me -- thanks everyone for all your help to
First, thanks for all your help! You really make a difference, and I GREATLY
Thanks in advance for your help. This list is to update an existing record,
Update Thanks to Marc's help the AlphaPagedList class is now available on CodePlex if
Update: Thanks guys, I didn't realize it was very close to zero but not
I'm not at all familiar with Tapestry 4.0.1 and need to update a legacy
Need your help with authenticating an active directory user ID against LDAP. My problem
I need your help with making comments show below my articles. At the moment

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.