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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Date format issue

Author  Topic 

ravininave
Posting Yak Master

111 Posts

Posted - 2010-04-08 : 02:44:12
in my query is use

Where cDate >= @Date1 and cDate <= @Date2

It works fine locally but when online it doesn't shows any data maybe there is some problem with date format how should I format the Date



VB6/ASP.NET
------------------------
http://www.nehasoftec.com

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-04-08 : 02:47:14
Check the datatype of @Date1,@Date2.

Make sure the column cDate also datatime datatype!

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

ravininave
Posting Yak Master

111 Posts

Posted - 2010-04-08 : 03:41:24
My Procedure

CREATE PROCEDURE [dbo].[FetchComm]
(@FDate_1 [datetime],
@TDate_2 [datetime])

AS
BEGIN
Select MonComm.*,ePartners.PartName, ePartners.BankName, ePartners.BankAc, ePartners.BankBranch, ePartners.IFSCCode, ClientDets.ClientName as [Client] from MonComm Inner Join ePartners on MonComm.PartCode = ePartners.PartCode Inner Join ClientDets on MonComm.KarvyCode=ClientDets.KarvyCode Where MonComm.Date1 >= @FDate_1 AND MonComm.Date2 <= @TDate_2
END
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-04-08 : 05:06:22
How do you input to stored procedure?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-08 : 05:19:31
try to use standard format CCYYMMDD for date values

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ravininave
Posting Yak Master

111 Posts

Posted - 2010-04-09 : 02:27:33
quote:
Originally posted by visakh16

try to use standard format CCYYMMDD for date values

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/




Can u explain with Example. How could I use format CCYYMMDD in query. Is it like cDate > = format(@Date1,"CCYYMMDd")

VB6/ASP.NET
------------------------
http://www.nehasoftec.com
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-04-09 : 03:02:05
When you give inputs to date variable, use YYYYMMDD format

example

March 10, 2010 can be expressed as 20100310

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -