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

  • Home
  • SEARCH
  • 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 6605603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:18:11+00:00 2026-05-25T19:18:11+00:00

My brief is to implement a interface which has a method that looks something

  • 0

My brief is to implement a interface which has a method that looks something like ‘GetValuesSqlStatement’ below:

public string SqlPattern { get { ... } }
//this varies; eg. "SELECT name FROM someTable WHERE startDate < {0}"

public string DatabaseType { get { ... } }
//this varies; eg. "SqlServer"

public string GetValuesSqlStatement(List<object> paramValues)
{
    //...desired logic here, using DatabaseType, SqlPattern and paramValues
}

Now, because this must produce an executable SQL statement, I can’t use parameters in the execution of the query. And the interface I must implement is non-negotiable. What is the best way to proceed to make sure the dates in the result are interpreted by the database query engine correctly? Assuming that the paramValues contain .NET DateTime objects, how should these be formatted to string before plugging into the SQL pattern string? What is the most common universal date format across must databases? (eg. something like ‘dd-mmm-yyyy’).

NB: I only really need to worry about Sql Server from 2005 onwards and Oracle 10g onwards. So the SQL must be valid T SQL and PL SQL and mean the same thing in both flavours.

  • 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-25T19:18:12+00:00Added an answer on May 25, 2026 at 7:18 pm

    I think the only unambiguous date format for SQL Server is YYYYMMDD:

    • Bad habits to kick : mis-handling date / range queries

    • Bad Habits to Kick : Using shorthand with date/time operations

    Oracle uses a DATE ‘YYYY-MM-DD’ notation:

    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements003.htm#BABGIGCJ

    While there may be a notation which works for both in some scenarios, I doubt there is one which works for both with all possible regional server settings.

    Like you said, YYYY-MON-DD might be useful – it’s Oracle’s default.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From a brief look using Reflector, it looks like String.Substring() allocates memory for each
Hopefully I've described it correctly. I have a 'generic method' which looks like the
I've this brief snippet: String target = baseFolder.toString() + entryName; target = target.substring(0, target.length()
Hi I was tasked with building an app with the following brief. Implement an
Brief blurb, My skill in .net has been called innovative but I would prefer
Brief Description of the app: I have written a Delphi application that allows a
I intended to implement a chat feature in my rails application. After a brief
I have a collection of objects like so: public enum ObjectType { Type1, Type2
I've recently tried to implement an asynchronous callback model, so that when developers consume
Brief background: I have two-step login page, which after step 1 sends one-time code

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.