View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Purnima Purnima is offline
external usenet poster
 
Posts: 15
Default Passing dates to Sql Server 2005 stored procedure

Thanks Joel.

But I am afraid this will not work for me.

We have a number of similar stored procedures all accepting date imputs and
changing the data type of the input is not an option for us. I cannot use
string in place of datetime in the stored procedure.

And because of this, using Format in Excel is not going to help.

I wish Excel would also let us change the International settings instead of
just read them. This would have solved my problem.

"joel" wrote:


Excel stores dates as a number with Jan 1, 1900 being the number 1 and
Jan 2, 1900 being the number 2. Each hour is 1/24, and each minute is
1/(24*60).

So Jan 1, 1900 8:00 AM is 1 + 8/24 = 1.333333


You need to convert the excel date to a string using the FORMAT
function in VBA


StrDate = Format(MyDate,"yyyy-mm-dd")


Then use StrDate in you SQL statements.


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=207503

http://www.thecodecage.com/forumz

.