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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

slq code error

Status
Not open for further replies.

Cpreston

MIS
Mar 4, 2015
972
GB
I am looking into a view and part of the view as this code

RIGHT ('00000000' + OrderNumber, 8) + '_' + SUBSTRING(ProcessDate, 7, 4) +
RIGHT ('00' + SUBSTRING(ProcessDate, 4, 2), 2) + RIGHT
('00' + SUBSTRING(ProcessDate, 1, 2), 2) + '_' + CASE WHEN CONVERT
(int , LEFT (ProcessTime , 2)) < CASE WHEN DATEPART(weekday ,
CONVERT (datetime , isnull(CONVERT (datetime , RIGHT (processdate , 4) +
'-' + substring(processdate , 4 , 2) + '-' + LEFT (processdate , 2)) ,
'2000-01-01'))) = 6 THEN 13 ELSE 14 END THEN '1' ELSE '2'
END

Unfortunately I am not so hot on code but when running the view I am getting this error message

"The conversion of a varchar data type in a datetime data type resulted in an out of range value"

I am not sure which part may be incorrect and appreciate it may not be evident without know all the tables and field definitions etc....

But if anyone as any ideas what may be wrong it would be useful, thanks
 
Ignore this thread please, all sorted.

How do you delete threads???

Thanks
 
You can't delete threads, but you can post your solution so that others may learn. :)


Just my 2ó

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top