aspx Tutorial

NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here

Toolbar

Get our toolbar!

Advertize



Posted by Aamir Hasan   on Sunday, March 27, 2011 Total Views:  

In this example, you will see how to get month name from input data. I have used build in function named DATETIME. DATETIME function used two parameters. DATETIME function will always return a string. I have created a virtual table and inserted some dummy records to display it.

Syntax

DATENAME ( datepart , date )

Example

DECLARE @PATIENT TABLE

    (

      ID BIGINT IDENTITY ,

      FULLNAME VARCHAR(50) ,

      GENDER CHAR ,

      BIRTHDAY DATE

    )

INSERT  INTO @PATIENT

VALUES  ( 'AAMIR HASAN', 'M', '2000-11-11' ),

        ( 'AWAIS AHMED', 'M', '2006-10-01' ),

        ( 'HINA KHAN', 'F', '2005-12-02' ),

        ( 'SABA KHAN', 'F', '2004-09-04' ),

        ( 'DIVAN', 'M', '2003-03-08' ),

        ( 'AAMIR', 'M', '2002-01-11' )

SELECT  ID ,

        FULLNAME ,

        GENDER = CASE GENDER

                   WHEN 'M' THEN 'MALE'

                   WHEN 'F' THEN 'FEMALE'

                 END ,

        [BORTHDAY MONTH NAME] = UPPER(DATENAME(MONTH, BIRTHDAY))

FROM    @PATIENT

Output

Download

How to get Month Name in T-SQL.sql (682.00 bytes)

Protected by Copyscape Online Plagiarism Tool

Comments (8) -

Chinese Restaurant Supplies
Chinese Restaurant Supplies United States
10/15/2013 9:28:54 PM #

Hi there, simply become aware of your blog through Google, and found that it's truly informative. I'm gonna be careful for brussels. I will appreciate should you continue this in future. Lots of people will be benefited out of your writing. Cheers!|

Josefa Rodabaugh
Josefa Rodabaugh United States
6/3/2014 7:09:31 AM #

You should take part in a contest for one of the best blogs on the web. I will recommend this site! More For xxx video http://www.uxxx.me/

Andres Rupar
Andres Rupar United States
9/18/2014 8:28:32 AM #

I usually learn something when i stop by here, Eric. Thanks!

Erwin Lundholm
Erwin Lundholm United States
9/27/2014 10:29:11 PM #

wow there is some very cool gadgets in here

Carroll B. Merriman
Carroll B. Merriman United States
12/24/2014 8:21:59 PM #

Between me and my husband we've owned more MP3 players over the years than I can count, including Sansas, iRivers, iPods (classic & touch), the Ibiza Rhapsody, etc. But, the last few years I've settled down to one line of players. Why? Because I was happy to discover how well-designed and fun to use the underappreciated (and widely mocked) Zunes are.

Matthew C. Kriner
Matthew C. Kriner United States
12/24/2014 8:30:39 PM #

If you're still on the fence: grab your favorite earphones, head down to a Best Buy and ask to plug them into a Zune then an iPod and see which one sounds better to you, and which interface makes you smile more. Then you'll know which is right for you.

rape porn tube
rape porn tube United States
12/25/2014 6:57:31 PM #

Apple now has Rhapsody as an app, which is a great start, but it is currently hampered by the inability to store locally on your iPod, and has a dismal 64kbps bit rate. If this changes, then it will somewhat negate this advantage for the Zune, but the 10 songs per month will still be a big plus in Zune Pass' favor.

rape porn videos
rape porn videos United States
12/25/2014 7:07:37 PM #

Zune and iPod: Most people compare the Zune to the Touch, but after seeing how slim and surprisingly small and light it is, I consider it to be a rather unique hybrid that combines qualities of both the Touch and the Nano. It's very colorful and lovely OLED screen is slightly smaller than the touch screen, but the player itself feels quite a bit smaller and lighter. It weighs about 2/3 as much, and is noticeably smaller in width and height, while being just a hair thicker.

josh maverick
josh maverick United States
1/20/2015 6:43:17 AM #

There is visibly a bundle to identify about this.  I believe you made some nice points in features also.

Kristofer Schlick
Kristofer Schlick United States
1/21/2015 3:30:10 AM #

Nice topic. i think you should write something more about this so that can help us more to know about this.

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5