on 10-31-2015 4:55 PM
Hi all,
Doctime field in SAP is showing as 12:33PM. But if I'm trying to fetch the doctime field in CR, it is showing as 1233(numeric).
How to convert this into TIME?
Thanks&Regards,
Saikrishna.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
CREATE FUNCTION [dbo].[ConvertSapTS2TimeString]
(
-- Add the parameters for the function here
@SapTS int
)
RETURNS varchar(8)
AS
BEGIN
-- Declare the return variable here
DECLARE @TimeString varchar(8)
DECLARE @Str varchar(6);
-- Add the T-SQL statements to compute the return value here
SET @Str = CAST(@SapTS AS VARCHAR(6));
IF @SapTS < 100000
BEGIN
SET @TimeString = '0' + SUBSTRING(@STR, 1, 1) + ':' + SUBSTRING(@STR, 2, 2) + ':' + RIGHT(@STR, 2);
END
ELSE
BEGIN
SET @TimeString = LEFT(@STR, 2) + ':' + SUBSTRING(@STR, 3, 2) + ':' + RIGHT(@STR, 2);
END;
-- Return the result of the function
RETURN @TimeString
END
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.