Tuesday, 15 July 2014

datetime - Replace YEAR part with custom year in SQL Server Select statement -


I'm working with a table with the SQL Server and DOB [Date of birth] column.

I saved a value in the table against that column, which is = ' 5 May 1988 12:00 AM ' but I ' 5 May 1900 12 : 00 AM 'column is required.

I have this basic query:

  select DOBFROM dbo.contact  

Result May 5 1988 12:00 AM

Any help?

If you are going to change the custom year, then it can help you here GETDATE () is your date column .

  DECLARE @CustomYear = '1900' Select the place (CAST (GETDATE ()) as VARCHAR (

March 17, 19 00 4:12 am << / p>

/ P>

No comments:

Post a Comment