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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:50:57+00:00 2026-06-06T12:50:57+00:00

Snippet from a SQL query (using SQL Server 2008 R2): , CONVERT (VARCHAR(10), s.ENTER_DATE,

  • 0

Snippet from a SQL query (using SQL Server 2008 R2):

, CONVERT (VARCHAR(10), s.ENTER_DATE, 101) "Enrollment Start Date"

, CONVERT (VARCHAR(10), (ISNULL(CAST(s.LEAVE_DATE AS VARCHAR(10)), '')) ,101) "Enrollment Drop Date"

The top line works fine to output the date to proper 101 format (eg: 06/22/2012).

The bottom line works as desired to remove any NULL values to a blank, but… for any date values it does not output that date to proper 101 format, instead outputting the date in the default format (eg: Jun 22 2012).

I’ve played with the code and searched online but I cannot get the desired result.

Can anyone suggest a solution?

Thank you!

  • 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-06T12:50:58+00:00Added an answer on June 6, 2026 at 12:50 pm

    Your second expression evaluates like this:

    1. A date or datetime value is converted to a string (using CAST())

    2. ISNULL() is applied which returns the same result (the same string) if it is not NULL.

    3. The string is converted to… a string (using CONVERT() this time).

    So, as you can see, you get the wrongly formatted date as a result of the innermost conversion.

    You just need to apply ISNULL differently, I think. Probably like this:

    ISNULL(CONVERT (VARCHAR(10), s.ENTER_DATE, 101), '') "Enrollment Start Date"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using SQL Server manager 2008. I have a query as follows: SELECT dbo.iLines.Part,
I'm currently wrestling with an Oracle SQL DATE conversion problem using iBATIS from Java.
I have created an stored procedure in SQL Server 2008 and it contains the
I am using Linq-To-Sql to populate my business layer. Here is a snippet of
I am using the Select query as SELECT id, ordering FROM `jos_menu` WHERE ordering='.$rec['ordering']
I just starting to query XML within a SQL Server database. I am having
I am attempting to read the results from a SQL query into a List(Of)
I am using VS2005 C# and SQL Server 2005. I have an Excel file
I am trying to execute a sql query as another login using the 'Execute
I'm inserting large number of records using LinqToSql from C# to SqlServer 2008 express

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.