Home » RDBMS Server » Server Administration » Urgent.. SQL Server Date Problem...
Urgent.. SQL Server Date Problem... [message #54285] Fri, 08 November 2002 12:14 Go to next message
sai sreenivas jeedigunta
Messages: 370
Registered: November 2001
Senior Member
Hello Techies,
I have a table say 'test' and i have a column 'dt' which is a datetime column... i am inserting a value in the following manner

insert into test values(convert(char(10),'30-12-2002',103))

and i am getting an error

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
The statement has been terminated.The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

Please provide me the correct statement.

sai
Re: Urgent.. SQL Server Date Problem... [message #54290 is a reply to message #54285] Fri, 08 November 2002 12:59 Go to previous messageGo to next message
Jeff A.
Messages: 3
Registered: November 2002
Junior Member
This might be what you want?

insert into test values (to_date('30-12-2002','DD-MM-YYYY'))
Re: Urgent.. SQL Server Date Problem... [message #54295 is a reply to message #54290] Fri, 08 November 2002 21:07 Go to previous messageGo to next message
sai sreenivas jeedigunta
Messages: 370
Registered: November 2001
Senior Member
I need the statement for SQL Server Please..

sai
Re: Urgent.. SQL Server Date Problem... [message #55192 is a reply to message #54290] Thu, 09 January 2003 15:10 Go to previous messageGo to next message
aFriend
Messages: 1
Registered: January 2003
Junior Member
Have you simply tried this
insert into table(column) values ('30-12-2002');
Re: Urgent.. SQL Server Date Problem... [message #55199 is a reply to message #54285] Fri, 10 January 2003 03:32 Go to previous messageGo to next message
aifos
Messages: 1
Registered: January 2003
Junior Member
Hello,

try this :)

insert into test values(convert(datetime,'30-12-2002',103))

I think this will work.

For SQL SERVER you use the convert function the first parameter is the datatype of the column.

Bye,

Aifos
Urgent.. SQL Server Date Problem... [message #55348 is a reply to message #54285] Mon, 20 January 2003 00:39 Go to previous message
Palaniappan
Messages: 4
Registered: December 2002
Junior Member
Hi my query is given below but the date conversion error is comming pls. help me..

SELECT DISTINCT
TD.Emp_no,
B.H01_First_Name Name,
C.H40_Emp_Status3 Operation,
TD.Payroll,
B.H01_Dummy1 Entity
FROM
H01_IDENTFCATN B,
H10_EMPASGN C,
( SELECT A.H01_EMP_NUM Emp_no,
A.P06_PAYROLL_CODE Payroll,
A.P03_Process_Period Period,
A.C03_Organisation_Code Org,
COUNT(A.CTS_DATE) CL_DAYS,
A.Sick_Lv_A SL_A,
A.Sick_Lv_NA SL_NP,
A.No_Pay_Hrs_A UL_A,
A.No_Pay_Hrs_NA UL_NP
FROM

RSSB_AI_CTS_TIME_DETAILS_SG A,
( SELECT B.P03_Process_Period,
B.P03_Process_period_desc
FROM P03_PROCESS_PERIODS B
WHERE MONTH(B.P03_Period_From_date) = month('31/12/2002') AND
YEAR(B.P03_Period_From_date)= year('31/12/2002')
)TR
WHERE YEAR(A.CTS_DATE) = YEAR('31/12/2002') AND
A.P06_PAYROLL_CODE = RTRIM('REG1H') AND A.P03_Process_Period <= TR.P03_Process_Period
AND (A.Sick_Lv_A > 0.00 OR A.Sick_Lv_NA > 0.00 OR A.No_Pay_Hrs_A > 0.00
OR A.No_Pay_Hrs_NA > 0.00)
GROUP BY A.H01_EMP_NUM, A.P06_PAYROLL_CODE, A.P03_Process_Period, A.C03_Organisation_Code, A.Sick_Lv_A,
A.Sick_Lv_NA, A.No_Pay_Hrs_A, A.No_Pay_Hrs_NA
) TD
WHERE TD.Org = B.C03_Organisation_code AND TD.Emp_no = B.H01_EMP_NUM
AND B.H01_Dummy1=RTRIM('32') AND TD.Org = C.C03_Organisation_code
AND TD.Emp_no = C.H01_EMP_NUM AND C.C03_Organisation_code =B.C03_Organisation_code
AND C.H01_EMP_NUM = B.H01_EMP_NUM
AND YEAR(C.H10_Effective_Date_From) =year('31/12/2002')
AND C.C02_Function_Code =RTRIM('32') AND C.C02_Function_Code = B.H01_Dummy1
AND C08_Catg_code = 'SGN'

palani
Previous Topic: Oracle Server Installation
Next Topic: Database Cloning in 9i
Goto Forum:
  


Current Time: Thu Sep 19 21:53:52 CDT 2024