If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > how to insert current date in sql server

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-19-04, 23:04
aassaa aassaa is offline
Registered User
 
Join Date: Dec 2004
Posts: 2
how to insert current date in sql server

hi all

am new here
can any one plz help me my problem is

am trying to insert current date using asp aand sql server

when i insert date i look to database and found 1/1/1900 i search the net but nothing work

column data type is datetime

plz help me
Reply With Quote
  #2 (permalink)  
Old 12-20-04, 00:39
MrWizard MrWizard is offline
Registered User
 
Join Date: Mar 2003
Location: Atlanta, GA
Posts: 191
Option 1: UPDATE tablename SET datefieldname =' & date() & "'"
Option 2: INSERT INTO tablename (datefieldname) VALUES ('" & date() & "')
__________________
Tim
Reply With Quote
  #3 (permalink)  
Old 12-20-04, 00:47
aassaa aassaa is offline
Registered User
 
Join Date: Dec 2004
Posts: 2
thanks for help

but when i use this error occured
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

i try this but another error occuer
getdate="select convert(datetime, getdate()) as dd"
set rs=server.createobject("adodb.recordset")
call connect
rs.open getdate,cn
date1=rs.fields("dd")
response.write date1

SqlInsert ="insert into inbox"
SqlInsert = SqlInsert & "(name,country,email,subject,massege,id,date1,chec ked)"
SqlInsert = SqlInsert & "values('"& name &"','" & country & "','" & email & "','" & subject & "','" & massege & "'," & id & ",'" & rs.fields("dd") & "','" & 1 & "')"

the error will be
Syntax error converting datetime from character string.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On