Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Jagger
Starting Member
3 Posts |
Posted - 2010-06-07 : 19:16:54
|
| Hi, I have a table with daily visits from sales persons.In this table there are few attributes for example....salesperson, customer name, address, main contact and date of the visits like 05.22.2010 13:46:40.I would like to make daily report which shoould be in real time with some command in order to get always current date.It means that any manager or user in our company when press button for this report get always all visits per salesperson on current date.Is it possible to make something like this?How to make this report?regardsJagger |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2010-06-07 : 19:31:37
|
| where dateColumnInyourTable >= dateadd(day,datediff(day,0,getdate()),0)JimEveryday I learn something that somebody else already knew |
 |
|
|
Jagger
Starting Member
3 Posts |
Posted - 2010-06-07 : 20:06:00
|
| Thanks.What to do if I have date in this format 05.22.2010 13:46:57If I try to execute this command:select datefrom visitswhere date >= dateadd(day,datediff(day,0,getdate()),0)I get this error message:An expression of noon-bolean type specified in a context where a condition is expected, near datewhat is a problem? |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2010-06-07 : 20:21:25
|
| The format should be fine. You probably have a syntax error somewhere. Your query works when I run it. Could you post the query that is giving you this error? Try putting date in brachets firstselect [date]from visitswhere [date] >= dateadd(day,datediff(day,0,getdate()),0)JimEveryday I learn something that somebody else already knew |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-06-08 : 02:30:03
|
quote: Originally posted by Jagger Thanks.What to do if I have date in this format 05.22.2010 13:46:57If I try to execute this command:select datefrom visitswhere date >= dateadd(day,datediff(day,0,getdate()),0)I get this error message:An expression of noon-bolean type specified in a context where a condition is expected, near datewhat is a problem?
This error will occur only if you runselect datefrom visitswhere dateMadhivananFailing to plan is Planning to fail |
 |
|
|
Jagger
Starting Member
3 Posts |
Posted - 2010-06-08 : 03:30:12
|
| It works now. I forgot to make brackets.Thanks to all. |
 |
|
|
|
|
|
|
|