CREATE TABLE #test
DateCol DATE CONSTRAINT DF_Test_DateCol DEFAULT ( GETDATE() )
Select allOpen in new window
CREATE TABLE #tmp (id int, dt date DEFAULT CAST(GETDATE() as date))
INSERT INTO #tmp (id) values (1), (2), (3)
SELECT * FROM #tmp
GETDATE() is actually Sybase syntax carried over to SQL and is not ansi-compliant, so it may be being phased out by MS.
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent