Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
624 views

SQL Server 2012 - Convert(varchar,'2018-12-16 17:33:29',105) + ' ' Convert(varchar,'2018-12-16 17:33:29',108) is not showing correct data

I have a datetime datatype column with the data format '16-12-2018 17:33:29' (dd-mm-yyyy hh:mm:ss). So if I get input data as 2018-12-16 17:33:29, the data needs to be converted into '16-12-2018 17:33:...
Sathiya Kumar V M's user avatar
3 votes
2 answers
327 views

Calculating Age of Years in SQL

I need some help with SQL Server 2012 trying to calculate an Aging Years Field for a report. Basically, I have two fields StartDateTime and EndDateTime and here is some sample data below: ...
smul86's user avatar
  • 411
3 votes
2 answers
76 views

SQL: All the suggested GetDate () methods are not working

I'm doing an assignment and I was stuck at this place for about couple of days. Getdate () is not working for this procedure. I used all the suggested methods. But again I have to use the update ...
Ami Kumara's user avatar
0 votes
1 answer
43 views

Retrieve yesterday's records using SQL View

Hi I'm trying to retrieve yesterday tranfer row using date. when creating the view. I filtered the date to be retrieve yesterday value but it keeps coming with null value. the code is WHERE (...
Bashar Al-tekreeti's user avatar
0 votes
1 answer
232 views

Purging 7 day old data from SQL while also converting date format to INT

I need to set up an automated data purging (delete 7 day old data) on my SQL box. The date column which helps me decide on whether to/not to delete the row set is in YYYYMMDD format. I understand ...
Srayan Guhathakurta's user avatar
1 vote
1 answer
5k views

Convert GetDate() into bigint

I am using MS SQL Server 2012 How do I convert GetDate() into bigint? I am trying to get records for past 24 hours, and the only column that I have are bigint (not datetime) select GetDate() <...
Glowie's user avatar
  • 2,309
0 votes
2 answers
4k views

>= GETDATE() not returning rows with today's date

--------------------- | ID | date | |-----+-------------| | 1 | 2013-12-30 | | 2 | 2014-01-03 | | 3 | 2014-02-02 | --------------------- column ID is int type column date is Date ...
j_t_fusion's user avatar
0 votes
2 answers
1k views

GETDATE() doesn't return the milliseconds and minutes

declare @Date date SET @Date =GETDATE() print @date Declaration gives me the result : 2013-08-04 But I need also milliseconds and minutes. How I can achieve this?
sakir's user avatar
  • 3,512
1 vote
3 answers
2k views

Trigger to update record when Value = GETDATE()

my experience with triggers is that it does something after an update,insert or delete. But is it possible to create a trigger to update a record automatically when its date is today? for example, I ...
Bashar Al-Khalili's user avatar