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 2000 Forums
 Transact-SQL (2000)
 How to set dateformat ?

Author  Topic 

gpiva
Starting Member

47 Posts

Posted - 2004-08-31 : 22:04:49
how can i use the DATEFORMAT in a store procedure ?

this is my code

CREATE PROCEDURE UpdateTimeTable
@ID int,
@IToursXrefRoutesId int,
@ITransportId int,
@DDepartureTime datetime,
@DDepartureDate datetime,
@DArrivalTime datetime,
@DArrivalDate datetime

AS
SET DATEFORMAT dmy
UPDATE TimeTable
SET
IToursXrefRoutesId = @IToursXrefRoutesId,
ITransportId = @ITransportId,
DDepartureTime = @DDepartureTime,
DDepartureDate = @DDepartureDate,
DArrivalTime = @DArrivalTime,
DArrivalDate = @DArrivalDate,
LastModified = GetDate()
WHERE (ITimeTableId = @ID)
GO


Any help appreciate.


Carlo

mk_garg20
Constraint Violating Yak Guru

343 Posts

Posted - 2004-08-31 : 22:30:20
You are setting date using
SET DATEFORMAT dmy

What you want to know?


mk_garg
Go to Top of Page

gpiva
Starting Member

47 Posts

Posted - 2004-08-31 : 22:39:15
i run an execute with java jdbc that look like this

UpdateTimeTable 6, 8 , 7 , '05/08/2004' , '07/07/2004','11:00:00.00' ,'12:00:00.00'

sql server use 08 as a DAY and 05 as MONTH

i want to run the same execute but I want to force sql to use

05 as a DAY and 08 as MONTH i try with set dateformat
from the query analizer

like this
set dateformat dmy
go
UpdateTimeTable 6, 8 , 7 , '05/08/2004' , '07/07/2004','11:00:00.00' ,'12:00:00.00'

works fine... I want to implement the dateformat in my storeproc
i tried with the code that i post but doasnt work...

thank you,

Carlo.


i





quote:
Originally posted by mk_garg20

You are setting date using
SET DATEFORMAT dmy

What you want to know?


mk_garg

Go to Top of Page

mk_garg20
Constraint Violating Yak Guru

343 Posts

Posted - 2004-08-31 : 22:47:08
Have a look at this link as well
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=5949

mk_garg
Go to Top of Page

gpiva
Starting Member

47 Posts

Posted - 2004-08-31 : 23:12:01
Thank you for help I got it use convert on my storeproc.

Thank you..

quote:
Originally posted by mk_garg20

Have a look at this link as well
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=5949

mk_garg

Go to Top of Page
   

- Advertisement -