home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,518 of 19,505   
   Bob Barrows to Tony   
   Re: Is it possible to have this in sql s   
   23 Nov 11 12:01:55   
   
   From: reb01501@NOSPAMyahoo.com   
      
   Tony wrote:   
   > Hello!   
   >   
   > I just wonder if it's possible to have this   
   > DateTime.Today.AddYears(-14); in a where statement of an sql select   
   > like this.   
   > SelectCommand="SELECT OrderID, OrderDate, ShippedDate   
   >                           FROM Orders   
   >                           where CustomerID=@CustomerID   
   >                           and OrderDate >=   
   > DateTime.Today.AddYears(-14);"   
   > I have tried but I get error   
      
   Of course you did. Why would you expect a .Net function to be recognized in   
   SQL? Did you not think of looking in the documentation?   
      
   > so I don't think it's possible but just   
   > to be sure I ask anyway.   
   >   
   > //Tony   
   Look up the T-SQL functions in Books OnLine (BOL).  It's installed when you   
   install the SQL Server Client Tools. Look in the Documentation submenu in   
   the Start menu under SQL Server.The one you want is DATEADD().   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca