Site Search:
Sign in | Join | Help
4Penny.net

SQL Server (T-SQL)

Comments and notes on SQL Server 2000, 2005, and T-SQL

Returning the current time in SQL Server

From a recent email: 

I am trying to use SmartList Builder to build a query where a calculation is required showing the number of days an A/R transaction is past due.  Obviously, I have the DOCDATE from RM20101 but I need a column that tells me the current date so I can make this comparison…and I am not sure if there is a SQL Server table that I can pull in that shows this information to me.  I am pretty certain that there is not a GP table with current date in it just sitting there by default.

 

Answer:

Select getdate(), convert(varchar(10),getdate(),101)


Getdate() returns a date/time, the second part will strip the time

Comments

No Comments

About Steve Gray

Steve is a seasoned (translate: old) developer in VB and ASP.NET. He spends most of his time in Dynamics GP, writing custom mods for consulting firms. Crystal reports, eConnect, VS Tools for Dynamics... anything that comes along.