不确定我是否完全理解所需的输出,但如果您被迫将字符串组合在一起以生成不同格式的日期时间值,这可能会起作用。
DECLARE @strDate VARCHAR(50) = '3/25/13 10:06:38 AM',
@dtDate DATETIME,
@DateOnly VARCHAR(255),
@TimeOnly VARCHAR(255),
@output VARCHAR(255)
-- cast to datetime first to verify its a valid date
SET @dtDate = CAST(@strDate AS DATETIME)
-- parse/cast date and time to seperate variables
SET @DateOnly = CONVERT(VARCHAR(255),@dtDate,101)
SET @TimeOnly = CONVERT(VARCHAR(255),@dtDate,108)
-- duct tape them back together in the desired string format
SET @output = @DateOnly + ' ' + @TimeOnly
-- outputs '03/25/2013 10:06:38'
SELECT @output AS 'NewStringDate'