CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004
    Posts
    5

    Angry Incorrect use of dateadd() function

    Hi guys,

    I have a stored procedure which has a datetime parameter. But when I call it like this:

    exec spSomething dateadd(minute, 30, getutcdate())

    It complains as "Incorrect syntax near 'minute'.

    But when I call it like this:

    declare @time datetime
    set @time = dateadd(minute, 30, getutcdate())
    exec spSomething @time

    Everthing is OK. Why? Can you help me on this?

    Thank you !

  2. #2
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    Re: Incorrect use of dateadd() function

    exec spSomething(dateadd(minute, 30, getutcdate()))

    ?
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

  3. #3
    Join Date
    May 1999
    Location
    New Delhi, India
    Posts
    359

    Re: Incorrect use of dateadd() function

    all sp's expects the parameter while they do not perform any arithmetic on parameter and generate the value for their parameter.
    Whenever I hear "It can't be done", I know, I am close to success!!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured