select getdate() from sys.all_columns
How to execute getdate() more than once?
select getdate() from sys.all_columns
How to execute getdate() more than once?
One way would be to create a UDF
CREATE function dbo.mygetdate() RETURNS datetime AS
BEGIN
RETURN GETDATE();
END
GO
SELECT dbo.mygetdate() FROM sys.all_columns
What is it that you're actually trying to do in the big picture? Are you trying to generate random dates or trying to show the exact update time for each row to do something like temporally measure performance or ???
If the latter, then the function that @JamesK posted will absolutely do the trick.
select rand()
from sys.all_columns()
SELECT TOP 1000000
RAND(CHECKSUM(NEWID()))
FROM sys.all_columns ac1
CROSS JOIN sys.all_columns ac2
;