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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:58:40+00:00 2026-05-27T08:58:40+00:00

this is my scripts Select @Mydate [Date], ‘Normal DateTime’ [Describe] Select Convert(varchar,@Mydate,101) [Date],’Format 101′

  • 0

this is my scripts

Select @Mydate [Date], 'Normal DateTime' [Describe]
Select Convert(varchar,@Mydate,101) [Date],'Format 101' [Describe]

and result is:

  Date                            Describe
  2011-12-10 16:32:00.800         Normal DateTime

  Date                            Describe
  12/10/2011                      Format 101

but when I union this 2 scripts the result is different:

Select @Mydate [Date], 'Normal DateTime' [Describe]
Union
Select Convert(varchar,@Mydate,101) [Date],'Format 101' [Describe]


  Date                            Describe
  2011-12-10 16:32:00.800         Normal DateTime
  2011-12-10 00:00:00.000         Format 101

I think the SQL try to fix the number of characters in both raw, so how can I use union and get the previous results?

  • 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-27T08:58:41+00:00Added an answer on May 27, 2026 at 8:58 am

    Try this instead:

    Select CONVERT(VARCHAR(50), @Mydate, 121) [Date], 'Normal DateTime' [Describe]
    Union
    Select CONVERT(VARCHAR, @Mydate, 101) [Date],'Format 101' [Describe]
    

    Gives me an output of:

    Date                      Describe
    2011-12-10 16:32:00.000   Normal DateTime
    12/10/2011                Format 101
    

    When you cast both values to VARCHAR explicitly, they’ll show up correctly (I hope!)

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

Sidebar

Related Questions

I've inherited a few dozen sql scripts that look like this: select column_a, column_b,
I'm using this select style http://www.8stream.com/scripts/styleSelect/ I have the problem that the right select,
I have this script: select name,create_date,modify_date from sys.procedures order by modify_date desc I can
i have this script <select> <option value=1>one<img src=star.gif height=15 width=15></img> </option> </select> but it
So i have this script: <?php $query = mysql_query( SELECT meetup AS text, id
Here are the problem scripts: This is from the HTML file: <script type=text/javascript> var
I've recorded a few scripts with this tool, but when I run it, 100%
I have this piece of code: Page.ClientScript.RegisterClientScriptInclude(this.GetType(), Guid.NewGuid().ToString(), this.ResolveUrl(~/Scripts/min.js)); When we push to our
What does adding @ before a function do? I've seen this in some scripts
I see this often in the build scripts of projects that use autotools (autoconf,

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.