GetDate()

  • Thread starter Thread starter cgsanders7 via AccessMonster.com
  • Start date Start date
C

cgsanders7 via AccessMonster.com

I am trying to create a stored procedure in an Access adp. I am trying to set
a parameter with a default of today's date, so I tried to put in GETDATE()
and it gives me an error:
Literal of the correct data type required.
Does anyone know a way around this.
Also, I have found that you can't use GETDATE() in a function, so how do you
get the current date? If anyone knows an answer to this, please share. Thank
you in advance.
 
Hi,

u can handle it with a trick.

CREATE FUNCTION dbo.myPersonalDate() RETURNS datetime
AS
BEGIN
DECLARE @ReturnDate datetime
SELECT TOP 1
@ReturnDate = LAST_BATCH
FROM master..sysprocesses
WHERE SPId = @@SPID

RETURN @ReturnDate
END
GO

HTH ;-)

--
Gruß, Uwe Ricken
MCP for SQL Server 2000 Database Implementation

db-Berater GbR, 64390 Erzhausen
http://www.db-berater.de
http://www.memberadmin.de
http://www.conferenceadmin.de
____________________________________________________
dbdev: http://www.dbdev.org
APP: http://www.AccessProfiPool.de
FAQ: http://www.donkarl.com/AccessFAQ.htm
 
You don't tell us how you intend to call this SP, so it's hard to tell you
more on this. You should show us an example of your code so that we can
see where you want to go.
 
Back
Top