Date function

Results 1 to 3 of 3

Thread: Date function

  1. #1
    Jon Guest

    Default Date function

    I&#039;ve just switched from using an Access97 database as my data Source to SQL Server7. When I was making my &#039;insert into&#039; statements while using Access97 I used to use the following:<BR>str = "Insert into tblTable1(accountNo, dateEntered) values(9999, date());"<BR>As a result I would get todays date entered into the field dateEntered.<BR>When I use the date() function with SQL Server7 I get the date &#039;1/1/1900&#039; entered into the field. If you can help my get todays date into my SQL Server database I would be really greatfull.<BR>Thank You.<BR>

  2. #2
    vens Guest

    Default RE: Date function

    hi,<BR>u r getting 1/1/1900 cause the function is not returning the date value. So it takes 1/1/1900.<BR>Use proper syntax....<BR><BR>for eg:<BR><BR>"insert into tblTable1 values(&#039;somevaluehere&#039;,&#039;"&date&"&#0 39;)"<BR><BR>i hope its clear.<BR>vens

  3. #3
    Prem Guest

    Default RE: Date function

    In SQL server 7.0 the function getdate() is used to achieve the similar functionality.. <BR><BR>u can use :<BR>"Insert into tblTable1(accountNo, dateEntered) values(9999, getdate());"<BR><BR>Cheers..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts