Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 A way to store the date/time from my computer

Author  Topic 

crugerenator
Posting Yak Master

126 Posts

Posted - 2007-06-13 : 10:10:57
INSERT INTO post(Comment, A_ID, Title, Date)
VALUES ('#Comment#', '#A_ID#', '#Title#', '#Date#')

There's my query...

I was hoping there's a way to make the Date, which I have as date/time, get taken from my computer so the user doesn't have to enter anything into the text boxes on my page.

I'm using ColdFusion, and know I can do this through code, but am wondering if it's possible for sql to do this also.

And, if you know of any good ColdFusion sites, I would appreciate it...I really want to nest <cfoutput> tags, but it's really tricky.

nr
SQLTeam MVY

12543 Posts

Posted - 2007-06-13 : 10:27:12
getdate() will give you the server datetime
INSERT INTO post(Comment, A_ID, Title, Date)
select '#Comment#', '#A_ID#', '#Title#', getdate()

if you just want the date
INSERT INTO post(Comment, A_ID, Title, Date)
select '#Comment#', '#A_ID#', '#Title#', convert(varchar(8),getdate(),112)



==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -