Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #827
| From | "Bob Barrows" <reb01501@NOSPAMyahoo.com> |
|---|---|
| Newsgroups | comp.databases.ms-sqlserver |
| Subject | Re: Is it possible to have this in sql select DateTime.Today.AddYears(-14);" |
| Date | 2011-11-23 12:01 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <jaj8t5$qhk$1@dont-email.me> (permalink) |
| References | <4ecd1ba0$0$282$14726298@news.sunsite.dk> |
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().
Back to comp.databases.ms-sqlserver | Previous | Next — Previous in thread | Find similar
Is it possible to have this in sql select DateTime.Today.AddYears(-14);" "Tony" <johansson.andersson@telia.com> - 2011-11-23 16:49 +0100 Re: Is it possible to have this in sql select DateTime.Today.AddYears(-14);" "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2011-11-23 12:01 -0500
csiph-web