Create Date and DateTime using values in SQL Server

Year, Month, Day are columns in MyTable table

Create Date from numbers

To create Date: DATEFROMPARTS ( year, month, day )

Select
datetimefromparts([Year], [Month], [Day]) as Submission_Date
From MyTable

Output: 2019-01-02

Create Date and Time from numbers

To create Date and Time: DATETIMEFROMPARTS ( year, month, day, hour, minute, seconds, milliseconds )

Select
datetimefromparts([Year], [Month], [Day], 00,00,00,0) as Submission_Date
From MyTable

Output: 2022-06-20 00:00:00.000

Advertisement

Restore a Database in SQL Server

  • Open SQL Server Management Studio (SSMS).
  • Right click on Database. Click on Restore Database…
  • Click on Device. Click on Add and select the file to restore. Click Ok. Again click OK.
  • You will get a message that your database is successfully restored.
  • You will be able to the new database under the Database category.

Install SQL Server 2019

Below are the steps to setup SQL Server 2019

  • Scroll Down and install Express Edition
  • Select Basic installation type
  • Accept the License Terms
  • Verify the SQL Server installation location. Click on Install. It will take few minutes. When the installation is done, you will get below screen. You can install SSMS from here by clicking on Install SSSM button.
  • When you click on Install SSMS button, it will open a Web Page in a new tab. Scroll down to download it. It will start downloading .exe file of SSMS Setup.
  • Click on the file to open the installation wizard. Click on Install to start the installation.
  • This will install SQL Server Management Studio (SSMS).