How do i add time "23:00:00" to a date data type? I have mentioned the code below.

DECLARE @FIRSTDATE date = '2014-07-06'.
I need to add time to this without initializing it on the first place. SO basically it should look like  '2014-07-06 23:00:00'. As far as i know it can be done using something like dateadd(). 

DECLARE @FIRSTDATE date = '2014-07-06'.
I need to add time to this without initializing it on the first place. SO basically it should look like  '2014-07-06 23:00:00'. As far as i know it can be done using something like dateadd(). 
Assume you want to add minutes also: concatenate string date & time first, then convert to datetime.
DECLARE @FIRSTDATE char(10) = '2014-07-06', @FIRSTTIME char(8) = '23:40:20';
-- Combined date & time
SELECT [DateTime]=CONVERT(datetime, CONCAT(@FIRSTDATE, SPACE(1), @FIRSTTIME), 120);
GO
-- 2014-07-06 23:40:20.000
Datetime/string conversion:
http://www.sqlusa.com/bestpractices/datetimeconversion/
Kalman Toth Database & OLAP Architect
SQL Server 2014 Design & Programming
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Similar Messages

  • How do I add time stamp to photo in photoshop?

    How do I add time stamp to photo in photoshop? I have saved photos from a camera phone to the computer. They still have the META data on them (aka the date and time from when the picture was taken). How do I put them on there?

    The following is old but may still be valid with Yosemite (it addresses how to remove the name but indirectly also how to display it): http://osxdaily.com/2012/01/10/remove-user-name-from-menu-bar-os-x/

  • How can I add Time In Calendar

    How Can I add Time With Calendar In apps

    Please refer to "Oracle Applications Developer's Guide" manual.
    Applications Releases 11i and 12
    http://www.oracle.com/technetwork/documentation/applications-167706.html
    Thanks,
    Hussein

  • How do I add time capsule to existing network?

    How do I add time capsule to existing network?

    Ok.. I am still confused as an Express only has one ethernet for LAN not 4. So you perhaps have an extreme..
    If you have an airport extreme.. plug the TC into the extreme with ethernet.. and set it up as bridge in router.
    You can also create a wireless network that works alongside the extreme.. this is the best way.
    It is also possible to setup the TC to extend the wireless of the extreme.. but this will make backups much slower.. at least half the speed if not worse.

  • HT5312 how can i add a secure email address to my account if i don't know the answers to my security questions?

    how can i add a secure email address to my account if i don't know the answers to my security questions?

    I don't know either! I NEED HELP CAUSE I PUT MONEY INTO IT and they ask for my SECURITY QUESTION ANSWERS! When I try to change my security questions, which i forgot, they askk me for the ANSWERS TO MY SECURITY QUESTIONS!!!!!!!!!! I CAN"T DO IT IF I DON"T KNOW IT!

  • How can I add credit to my account via PayPal? I don't have a credit card? Thanks.

    How can I add credit to my account via PayPal? I don't have a credit card? Thanks.

    Open iTunes.  Scroll to the bottom.  Click "Redeem".

  • How do I Add groups to my contacts and delete a contact once it's in the group

    How do I Add groups to my contacts and delete a contact once it's in the group

    Hello mstern613
    The way the organization works is that it will have an all contacts and then your grouped contacts. You would not be able to just have the grouped contacts with out it being in all contacts. You can organize them on your iPhone by following the steps in the iPhone User Guide.
    iPhone User Guide
    http://manuals.info.apple.com/en_US/iphone_user_guide.pdf
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • How can i add effects to voice over .. i can't find voice effects in the latest version 10.0.1

    how can i add effects to voice over ..
    i can't find voice effects in the latest version 10.0.1

    aysar8 wrote:
    how can i add effects to voice over ..
    http://www.bulletsandbones.com/GB/GBFAQ.html#trackeffectequivsgbv10
    This FAQ entry offers a Minute GarageBand video tutorial
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • I just rented a film using my apple TV and was then asked to enter a code - which I haven't been asked for in long time. I have forgotten the code. Any quick solutions to the problem?

    I just rented a film using my apple TV and was then asked to enter a code - which I haven't been asked for in long time. I have forgotten the code. Any quick solutions to the problem?

    Hello anetsa
    It sounds like you have restrictions setup on your Apple TV. If you do not know your passcode to unlock it, then you will need to restore your Apple TV. Check out the articles below for more information about Restrictions as well as restoring your Apple TV.
    Apple TV: Understanding Restrictions (parental controls)
    http://support.apple.com/kb/HT200198
    Apple TV (2nd and 3rd generation): Restoring your Apple TV
    http://support.apple.com/kb/HT4367
    Regards,
    -Norm G.

  • How do I open/ re-install After Effects CC on my laptop, after I have put the app in the trash and deleted due to a difficulty? It is still installed in Creative Cloud.

    How do I open/ re-install After Effects CC on my laptop, after I have put the app in the trash and deleted due to a difficulty? It is still installed in Creative Cloud.

    Run the cleaner tool and reinstall.
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    Mylenium

  • How do I get the restriction pass code off ? I have forgotten the code.

    How do I get the restriction pass code off ? I have forgotten the code.

    I think you mean a restore to factory defaults/new iPad. See:
    iTunes: Backing up, updating, and restoring iOS software

  • How to un lock your Iphone 5 if I have forgotten the code?

    How to un lock your Iphone 5 if I have forgotten the code?

    See here for passcode
    http://support.apple.com/kb/HT1212

  • HT201304 I have forgottten the code to my restrictions, I have 9 failed passcode attempts, how can I unlock this part of my iPhone4

    I have forgotten the code to my restrictions, I have 9 failed passcode attempts, how can I unlock this part of my iPhone4? Help please!!

    Is the camera function restricted in Settings/General/Restrictions?
    What happens when you double click the home button, with your phone showing  the lock screen?

  • If i lock my Mac using iCloud "Find My.." with a code, but now i have forgotten the code i used but have my Mac bac.  How can i Unlock it????

    If i lock my Mac using iCloud "Find My.." with a code, but now i have forgotten the code i used but have my Mac bac.  How can i Unlock it????

    If you cannot remember the passcode, you will need to restore your device using the computer with which you last synced it. This allows you to reset your passcode and resync the data from the device (or restore from a backup).
    If you restore on a different computer that was never synced with the device, you will be able to unlock the device for use and remove the passcode, but your data will not be present.
    You may have to force iPad into Recovery Mode
    http://support.apple.com/kb/ht1808

  • How can I install InDesign CS6 with my newly purchased serial no. when I have deleted the trial?

    hi guys,
    I need to know how I can install InDesign CS6 with my newly purchased serial no. when I have deleted the trial version? In other words I do not have the trial version any longer so I need the actual download files/folder to link the serial number to. I have CC as well but that shouldn't make a difference - I need to run InDesign CS6 for third party plugins.
    Any help would be appreciated.
    MWP

    Hi there,
         If you have purchased CS6 Indesign Download from Adobe Online, then you can go ahead and login to your Adobe account and navigate to "My Adobe" > "My Orders" to locate the Order, its download and the serial number.
         You can also download the same trial version again and just use the serial number to activate it to a full version. Below is the link for the trial versions for CS6 versions:
    http://helpx.adobe.com/x-productkb/policy-pricing/cs6-product-downloads.html
    Regards,
    Jairaj

Maybe you are looking for