Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datetime conversion

Status
Not open for further replies.

be1s

Programmer
Dec 8, 2003
59
US
Here's a piece of code that runs well from QA but when placed in a SP it errors out with "Syntax error converting datetime from character string" Any idea why?

create table #test (appt_time varchar(255),
dtAppt_time datetime null)

insert into #test(appt_time)
values ('2:20 AM')

update #test
set dtAppt_time = convert(datetime,appt_time)
 
Can you post all the relevant code in your sp?

Regards,
AA
 
I have a similar problem and the reason is you have some fields that do not have any data/blank for the date column. That is one of the reasons for that kind of error message.

I do not know the solution of how to write a code to ignore blank spaces.

Dwight
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top