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 |
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2010-10-04 : 08:09:58
|
| I have the folowing stored procedure which compiles fine but does not return the required records. It does not return anything. In my sql table the date is stored liked this where it is dd/mm/yyyy and is datetime04/10/2010 00:00:00set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgo-- =============================================-- Author: <Author,,Name>-- Create date: <Create Date,,>-- Description: <Description,,>-- =============================================alter PROCEDURE [dbo].[spPP_GetRemindMeCases2] -- Add the parameters for the stored procedure here ASBEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here SELECT * from tblPP_Cases WHERE CA_RemindMe = getdate() andCA_Completed = 0 order by CA_RemindMe ascEND |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-04 : 08:13:30
|
quote: Originally posted by Pinto I have the folowing stored procedure which compiles fine but does not return the required records. It does not return anything. In my sql table the date is stored liked this where it is dd/mm/yyyy and is datetime04/10/2010 00:00:00set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgo-- =============================================-- Author: <Author,,Name>-- Create date: <Create Date,,>-- Description: <Description,,>-- =============================================alter PROCEDURE [dbo].[spPP_GetRemindMeCases2] -- Add the parameters for the stored procedure here ASBEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here SELECT * from tblPP_Cases WHERE CA_RemindMe = dateadd(d,datediff(d,0,getdate()),0) andCA_Completed = 0 order by CA_RemindMe ascEND
No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2010-10-04 : 08:18:28
|
| Thank you :-) |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-04 : 08:26:52
|
welcome No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-10-04 : 09:34:30
|
| will work so long as you've no time part stored in your table.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-10-05 : 06:16:16
|
| If it has timepart too,useCA_RemindMe >= dateadd(d,datediff(d,0,getdate()),0)andCA_RemindMe < dateadd(d,datediff(d,0,getdate())+1,0)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|