Now() function in SQL??

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Now() function in SQL??

    Hi,

    Before I've queried my Access DB using ASP pages. The SQL string then
    could contain: SELECT * FROM table1 WHERE date1>=Now().

    This time round my DB is on a SQL Server and I'm still using ASP for
    this. But now the Now() function returns an error message!? 'Now is not
    a recognized function name'.

    How do I tell the SQL Server then to only return future events in 'pure
    SQL code'?? I saw the solution somewhere once, but can't find it back ...

    Any help is appreciated!

    Jerome
    Jerome Guest

  2. Similar Questions and Discussions

    1. [PHP-DEV] named function arguments (was: Proposal: Dangling comma in function
      Christian Schneider wrote: Named parameters - i think is very good idea. I know i would use them. I'm really not sure about the correct...
    2. #25866 [Bgs]: Using error_reporting() function don't change output of phpinfo() function
      ID: 25866 Updated by: sniper@php.net Reported By: sfournier at dmsolutions dot ca Status: Bogus Bug Type: ...
    3. note 33714 added to function.register-tick-function
      please can anyone help me to discover if this function can be used to make a chat ---- Manual Page --...
    4. note 33575 added to function.register-shutdown-function
      If your script exceeds the maximum execution time, and terminates thusly: Fatal error: Maximum execution time of 20 seconds exceeded in - on line...
    5. note 33132 deleted from function.register-shutdown-function by sniper
      Note Submitter: markus@malkusch.de ---- I can't agree with nick at nickjoyce dot com. I use php 4.2.3 on linux and my shutdown function is...
  3. #2

    Default Re: Now() function in SQL??

    Jerome,

    GETDATE() is the SQL Server equivalent of Now().

    HTH,
    Nicole


    "Jerome" <jherr@no.mnhn.spam.lu> wrote in message
    news:uPwk2UOOEHA.1392@TK2MSFTNGP09.phx.gbl...
    > Hi,
    >
    > Before I've queried my Access DB using ASP pages. The SQL string then
    > could contain: SELECT * FROM table1 WHERE date1>=Now().
    >
    > This time round my DB is on a SQL Server and I'm still using ASP for this.
    > But now the Now() function returns an error message!? 'Now is not a
    > recognized function name'.
    >
    > How do I tell the SQL Server then to only return future events in 'pure
    > SQL code'?? I saw the solution somewhere once, but can't find it back ...
    >
    > Any help is appreciated!
    >
    > Jerome

    Nicole Calinoiu Guest

  4. #3

    Default Re: Now() function in SQL??

    > could contain: SELECT * FROM table1 WHERE date1>=Now().

    SELECT * FROM table1 WHERE date1>=GETDATE()

    --
    // myLittleTools.net : leading provider of web-based applications.
    // myLittleAdmin : online MS SQL manager
    // [url]http://www.mylittletools.net[/url]
    // [email]webmaster@mylittletools.net[/email]


    el.c. - myLittleTools.net Guest

  5. #4

    Default Re: Now() function in SQL??

    Jerome wrote:
    > Hi,
    >
    > Before I've queried my Access DB using ASP pages. The SQL string then
    > could contain: SELECT * FROM table1 WHERE date1>=Now().
    >
    > This time round my DB is on a SQL Server and I'm still using ASP for
    > this. But now the Now() function returns an error message!? 'Now is
    > not a recognized function name'.
    >
    The equivalent T-SQL function is GETDATE()

    SQL Books Online (usually referred to as BOL) is a great resource. If you've
    installed the SQL Server client tools on your machine, it will be in the SQL
    Server program group in your Windows Start menu.

    It is available online at
    [url]http://msdn.microsoft.com/library/en-us/startsql/portal_7ap1.asp[/url]

    And a downloadable version is available at:
    [url]http://www.microsoft.com/downloads/details.aspx?FamilyID=a6f79cb1-a420-445f-8a4b-bd77a7da194b&displaylang=en[/url]

    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

  6. #5

    Default Re: Now() function in SQL??

    use getdate() instead of now.
    "Jerome" <jherr@no.mnhn.spam.lu> wrote in message
    news:uPwk2UOOEHA.1392@TK2MSFTNGP09.phx.gbl...
    > Hi,
    >
    > Before I've queried my Access DB using ASP pages. The SQL string then
    > could contain: SELECT * FROM table1 WHERE date1>=Now().
    >
    > This time round my DB is on a SQL Server and I'm still using ASP for
    > this. But now the Now() function returns an error message!? 'Now is not
    > a recognized function name'.
    >
    > How do I tell the SQL Server then to only return future events in 'pure
    > SQL code'?? I saw the solution somewhere once, but can't find it back ...
    >
    > Any help is appreciated!
    >
    > Jerome

    Jeswanth Jaishanker Guest

  7. #6

    Default Re: Now() function in SQL??

    > This time round my DB is on a SQL Server and I'm still using ASP for
    > this. But now the Now() function returns an error message!?
    Well, yeah. SQL Server != Access! (Sorry, in Access, that would be, SQL
    Server <> Access!) ;-)

    Now() and GETDATE() and CURRENT_TIMESTAMP are covered here, which might make
    for useful reading in general:
    [url]http://www.aspfaq.com/2214[/url]

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)


    Aaron [SQL Server MVP] Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139