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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:18:56+00:00 2026-05-14T22:18:56+00:00

I make a query that return to me the count of Stored Procedure that

  • 0

I make a query that return to me the count of Stored Procedure that created everyday as follow

SELECT  convert(varchar, crdate, 103) as Date,Count(*) as Counter
FROM    sysobjects
WHERE   (xtype = 'p') AND (name NOT LIKE 'dt%')
Group by  convert(varchar, crdate, 103)

and its already work but dates appear in string format that i can’t order it such as below

01/03/2010  3
01/04/2008  4
01/05/2010  5
01/11/2008  1
01/12/2008  4
02/03/2008  1
02/03/2010  2
02/04/2008  4
02/05/2010  2
02/11/2008  2
02/11/2009  2
02/12/2008  4
03/01/2010  1
03/02/2010  2
03/03/2010  2
03/04/2008  2
03/04/2010  2
03/05/2008  1
03/05/2010  2

I want to make that in which date is in datetime format that i can make order by successfully, i tried convert(datetime, crdate, 103) but it show Full date

any idea of how to do ?

  • 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-14T22:18:56+00:00Added an answer on May 14, 2026 at 10:18 pm

    To get a sortable date you need year, then month, then date. use format “112”.

    SELECT  convert(varchar, crdate, 112) as Date,Count(*) as Counter
    FROM    sysobjects
    WHERE   (xtype = 'p') AND (name NOT LIKE 'dt%')
    Group by  convert(varchar, crdate, 112)
    order by  Date
    

    which gives this:

    Date        Counter
    20040711    124
    20040713    1
    20040725    1
    20040726    2
    20040803    6
    

    If you want to get the right sort order but a differently formatted date, then you can use a subquery like this.

    select CONVERT(varchar, GroupDate, 103) Date, Counter
    FROM (
        SELECT  MIN(crdate) as GroupDate,Count(*) as Counter
        FROM    sysobjects
        WHERE   (xtype = 'p') AND (name NOT LIKE 'dt%')
        Group by  convert(varchar, crdate, 112)
    ) A
    order by  GroupDate
    

    which yields

    Date        Counter
    11/07/2004  124
    13/07/2004  1
    25/07/2004  1
    26/07/2004  2
    03/08/2004  6
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how can I make this sql query return zero for the count function instead
I am using mssql and I want to make a query that returns a
I'm trying to make a SPARQL query, that returns a variable which contains two
I am trying to make a query that will insert multiple values from my
How to write a JPA query that make a join between 2 entities that
I want to make a query to list cats that took longer than average
I want to make a CAML query semi-smart - in that I can give
I make a query: String query = SELECT DISTINCT a FROM A a FETCH
Writing a SQL query that should return the average charges for a preceding 91
I want to make a query using which I can check that URL which

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.