Solved

Need help with a query

Posted on 2016-08-04
4
23 Views
Last Modified: 2016-08-04
Hi Experts,

I want to get the date in  'mmddyyyy'  format  the CURRENT_TIMESTAMP . I have an insert statement. The date '08042016' should come from the CURRENT_TIMESTAMP .

Thanks in advance.

INSERT INTO LOGINDETAILS
            ( UserID,              
            StdTimeIn,
                TodaysDate    
          )
     VALUES
                ( 1,                                    
                  CURRENT_TIMESTAMP,
                  '08042016'                        
          )
0
Comment
Question by:RadhaKrishnaKiJaya
  • 2
4 Comments
 
LVL 4

Expert Comment

by:vvk
Comment Utility
using convert function with style 12 shall give format you want, something like convert(nvarchar(8),getdate(),12)
0
 

Author Comment

by:RadhaKrishnaKiJaya
Comment Utility
Hi,

Thank you for your reply. With convert(nvarchar(8),getdate(),12)  I am getting '160804 '. but I need '08042016'

Thanks.
0
 
LVL 12

Accepted Solution

by:
Dustin Saunders earned 500 total points
Comment Utility
Try:
SELECT FORMAT(GetDate(),'MMddyyyy')

Open in new window

0
 

Author Closing Comment

by:RadhaKrishnaKiJaya
Comment Utility
Thanks. It worked!!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Creating and Managing Databases with phpMyAdmin in cPanel.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now