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 8841593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:45:26+00:00 2026-06-14T10:45:26+00:00

From SQL Server , I need to be able to pull some information from

  • 0

From SQL Server , I need to be able to pull some information from an Oracle database based on a date column.

SET @foo = 'SELECT * from OPENQUERY(' + @LinkedServer +
', ''SELECT *
    FROM Table1
    WHERE date_revised > '''''+@myDate+'''''')'

Don’t mind if the numbers of ' is off… I cut things out to make this shorter. I have tried using convert() on the SQL Server side, but I cannot seem to find a format that Oracle accepts, so it keeps throwing errors.

At a minimum, I require date, hours, and minutes. When testing values in SQL Developer (Oracle) to figure out acceptable formats, I keep running into this behavior:

select to_date('2010-11-15 12:21:00', 'yyyy/mm/dd hh:mi:ssam') from dual

15-NOV-10

Clearly, I specify I want time, but it just doesn’t agree with me. I’ve been stuck on this issue way too long.

In short, how do I format a SQL Server datetime into a format that Oracle’s to_date function will accept, and how do I make that function properly show date and time?

  • 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-06-14T10:45:27+00:00Added an answer on June 14, 2026 at 10:45 am

    I came up with my own solution since Oracle was being uncooperative with me. I basically take the DATEPARTS of everything and construct my own date-string in the same format in oracle. Thanks for your input all. When I get more time, I will try to get this working as it should. This bandaid will do for now.

    DECLARE @year varchar(4),
        @month varchar(3),
        @day varchar(2),
        @hour varchar(2),
        @meridian varchar(2),
        @minute varchar(2),
        @second varchar(2),
        @date smalldatetime,
        @OracleTime varchar(50);
    
    SET @date = (SELECT MAX(Processed) FROM MES_CAPP.Signoff)
    SET @year = YEAR(@date)
    SET @month = DATENAME(m,@date)
    SET @day = DAY(@date)
    -------------------------------------------------------------------------
    IF (DATEPART(hh, @date) >= 12)
    BEGIN
        SET @hour = DATEPART(hh, DATEADD(hh, -12, @date))
        SET @meridian = 'PM'
    END
    ELSE
    BEGIN
        SET @hour = DATEPART(hh, @date)
        SET @meridian = 'AM'
    END
    
    SET @minute = DATEPART(MINUTE, @date)
    SET @second = '00'
    
    SET @OracleTime = @day + '-'  + @month + '-' + @year + ' ' + @hour + ':' + @minute + ':' + @second + ' ' + @meridian
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to pull some BLOB data from a SQL Server 2005 database and
I need to write some data to SQL Server database from Linux in C++.
I need to move a database from SQL Server 2008 to 2005, did the
I need to retrieve random rows from SQL Server database. I am looking for
I'm retrieving a signed int from a SQL Server database and need to convert
How do I retrieve a date from SQL Server in YYYY-MM-DD format? I need
Currently, I need to be able to retrieve values from an SQL Server DB,
I need to transfer data daily from SQL Server (2008) to SQL Server (2005).
I need to get an image from a SQL Server as a byte[], and
Need to query my SQL server from Access using an ADO connection (for example),

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.