Re: I need some help here
- From: Hans Kesting <news.2.hansdk@xxxxxxxxxxxxxxx>
- Date: Fri, 15 Apr 2005 15:30:21 +0200
Joseph Byrns wrote:
You need to pass the date as a date rather than a varchar, so the procedure would look more like:
create proc test( @date datetime)
as begin
select name from table where DateEnt = @date
And I would also suggest you change the date to a long date string in the .NET part, so if you have a date object dt send dt.ToLongDateString (rather then the ShortDateString you are currently sending).
If you use parameters to call that sp, then you can just use a DateTime value. No need to convert to string.
"Chris" <Chris@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:39925A92-79DB-48D8-BFB0-4DCCB9633E5E@xxxxxxxxxxxxxxxx
Hi, I am storing dates in sql server in this format
2005-04-13 22:22:16.353
My asp.net app is passing the date as string like this 4/13/2005 to the foll sp
the *debugger* is *displaying* the DateTime value as mm/dd/yyyy, it doesn't store it internally as string.
create proc test( @date varchar(11))
as begin
select name from table where LEFT( CONVERT(varchar, DateEnt, 120), 10)= @date
but that doesn't work only if I pass it as 2005-04-13 22:22:16.353. I tested
the proc in sql server
exec test '4/13/2005' but this doesn't work.
exec test '2005-04-14' this works.
Please advice.
Thanks
Saif
-- Hans Kesting .
- References:
- I need some help here
- From: Chris
- Re: I need some help here
- From: Joseph Byrns
- I need some help here
- Prev by Date: SQLHelper & sorting
- Next by Date: How to get info about the site visited before my site?
- Previous by thread: Re: I need some help here
- Next by thread: Re: I need some help here
- Index(es):
Relevant Pages
|