Ciao questa funzione che ho trovato su internet potrebbe esserti utile
create FUNCTION [dbo].[StringToData]
(
@Appo varchar(20)
)
RETURNS datetime
AS
BEGIN
DECLARE @Data datetime
SET @Appo = Substring(@Appo,1,4) + '-' + Substring(@Appo,5,2) + '-' +
Substring(@Appo,7,2) + ' ' + Substring(@Appo,9,2) + ':' +
Substring(@Appo,11,2) + ':' + Substring(@Appo,13,2)
SET @Data = convert(datetime, @Appo, 120)
-- Return the result of the function
RETURN @Data
END
prende una data formato varchar (19000101000000) e la trasforma in Datetime(1900-01-01 00:00:00)
spero di esserti stato utile
ciao!:)