I get the following error:-
Msg 245, Level 16, State 1, Server XXXXXXXXXX, Procedure GetPOS, Line 78
Conversion failed when converting the varchar value 'o' to data type int.
Due to this line:-
SET @CurrentDate = CONVERT(bigint, REPLACE(CONVERT(varchar(10),GETDATE(),121),'-',''));
This only occurs rarely and i am trying to eliminate it happening, so maybe there is a better way to get the current date int the format I need, which is YYYYMMDD