MAy i know how to convert the right varchar(8) ?
Example - 20120106 043919 convert to 04:39:19
SELECT CONVERT(right,VARCHAR(8),STUFF(STUFF(EP_SCAN_DATE,12,0,':'),15,0,':'),112) AS SCANDATE from AcmkIMS.dbo.EP_SCAN_HIST
Not sure what you are trying; but if you want to convert a time string to time and you are using SQL Server version 2008 or later then try the below:
SELECT CAST(STUFF(STUFF(EP_SCAN_DATE,12,0,':'),15,0,':') AS TIME(0)) AS SCANDATE from AcmkIMS.dbo.EP_SCAN_HIST
DECLARE @ScanDate VARCHAR(8) = '04:39:19'
SELECT CONVERT(TIME(0), @ScanDate, 112)
Microsoft is conducting an online survey to understand your opinion of the Technet Web site. If you choose to participate, the online survey will be presented to you when you leave the Technet Web site.
Would you like to participate?