Re: Oh... no....
From: Louis Davidson (dr_dontspamme_sql_at_hotmail.com)
Date: 03/16/04
- Next message: Uri Dimant: "Re: How to Calculate Word Days"
- Previous message: Kevin Yu [MSFT]: "Re: Prepared Statement vs. Stored Procedure"
- In reply to: Aaron Bertrand [MVP]: "Re: Oh... no...."
- Next in thread: Utada P.W. SIU: "Re: Oh... no...."
- Reply: Utada P.W. SIU: "Re: Oh... no...."
- Reply: Aaron Bertrand [MVP]: "Re: Oh... no...."
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 15 Mar 2004 23:34:30 -0600
If you are forced to use this format (for some reason or another) you could
use replace to eliminate the dashes and pass it as varchar.
select cast('1999-10-20' as datetime)
select cast(replace('1999-10-20','-','') as datetime)
The only concernt I see is that the first one works fine for me, and I
cannot imagine why it wouldn't for you. It gives you an error when you run
the first command?
Obviously it would be better to use the "standard" format.
-- ---------------------------------------------------------------------------- ----------- Louis Davidson (drsql@hotmail.com) Compass Technology Management Pro SQL Server 2000 Database Design http://www.apress.com/book/bookDisplay.html?bID=266 Note: Please reply to the newsgroups only unless you are interested in consulting services. All other replies will be ignored :) "Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message news:%235s5ZMxCEHA.3348@TK2MSFTNGP11.phx.gbl... > Use YYYYMMDD. Any other format is vulnerable to locale settings, regional > issues, SET LANGUAGE, SET DATEFORMAT, etc. See > http://www.karaszi.com/sqlserver/info_datetime.asp for a primer... > > -- > Aaron Bertrand > SQL Server MVP > http://www.aspfaq.com/ > > > "Utada P.W. SIU" <wing0508@hotmail.com> wrote in message > news:uGlQa9wCEHA.1544@TK2MSFTNGP09.phx.gbl... > > I am really need your help... > > > > How to pass a date with format "yyyy-mm-dd" to a stored procedure? > > > > I have tried many method > > > > 1. > > the data type of the date_variable in stored proc have been set to > > "DATETIME" > > using parameter object of ADODB.command to password a string with a type > > adDBTimeStamp > > not work > > > > 2. > > data type of the date_variable in stored proc have been set to char(10) > > pass a char with type adChar > > and using weather CAST or CONVERT to change the char to datetime > > > > not work... > > > > return following error > > > > Microsoft OLE DB Provider for SQL Server error '80040e07' > > > > Syntax error converting datetime from character string. > > > > > > > > > >
- Next message: Uri Dimant: "Re: How to Calculate Word Days"
- Previous message: Kevin Yu [MSFT]: "Re: Prepared Statement vs. Stored Procedure"
- In reply to: Aaron Bertrand [MVP]: "Re: Oh... no...."
- Next in thread: Utada P.W. SIU: "Re: Oh... no...."
- Reply: Utada P.W. SIU: "Re: Oh... no...."
- Reply: Aaron Bertrand [MVP]: "Re: Oh... no...."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|