![]() |
Very easy?? How do I put today's date into SQL Server using ASP?
The date field I believe is of type datetime, but I'm sorry I have
absolutely no idea how to put today's date into a datetime column using ASP and SQL Server. Folks, I'm a LINUX guy!!! This is a project I have to get done today and that is about the only thing snagging it from being done before COB today. Please help. Thanx Phil |
Re: Very easy?? How do I put today's date into SQL Server using ASP?
If you want the date and time,
INSERT table(column) VALUES(CURRENT_TIMESTAMP) If you just want the date: INSERT table(column) VALUES({fn CURDATE()}) Better yet, make this the default for the table, then you don't even have to mention that table in the INSERT statement... try this out in query analyzer. CREATE TABLE blat ( foo INT, bar SMALLDATETIME DEFAULT {fn CURDATE()}, splunge DATETIME DEFAULT CURRENT_TIMESTAMP ) INSERT blat(foo) VALUES(1) INSERT blat(foo) VALUES(2) SELECT foo, bar, splunge FROM blat DROP TABLE blat And for future db-related questions, please post to the asp.db group. -- Aaron Bertrand SQL Server MVP http://www.aspfaq.com/ "Phil Powell" <soazine@erols.com> wrote in message news:1cdca2a7.0402161311.52524917@posting.google.c om... > The date field I believe is of type datetime, but I'm sorry I have > absolutely no idea how to put today's date into a datetime column > using ASP and SQL Server. > > Folks, I'm a LINUX guy!!! This is a project I have to get done today > and that is about the only thing snagging it from being done before > COB today. > > Please help. > > Thanx > Phil |
Re: Very easy?? How do I put today's date into SQL Server using ASP?
You could give the field a default value of getdate() in the db.
-- Jules http://www.charon.co.uk/charoncart Charon Cart 3 Shopping Cart Extension for Dreamweaver MX/MX 2004 |
| All times are GMT. The time now is 09:27 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.