[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Need help with a query

Posted on 2016-08-04
4
Medium Priority
?
59 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Expert Comment

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

Author Comment

by:RadhaKrishnaKiJaya
ID: 41742858
Hi,

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

Thanks.
0
 
LVL 13

Accepted Solution

by:
Dustin Saunders earned 2000 total points
ID: 41742863
Try:
SELECT FORMAT(GetDate(),'MMddyyyy')

Open in new window

0
 

Author Closing Comment

by:RadhaKrishnaKiJaya
ID: 41742874
Thanks. It worked!!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

650 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