declare @SQL_update nvarchar(2048)
declare @sheetno nvarchar(10)
declare @calltimereal datetime
set @SQL_update = 'update #t set ' + substring(@SQL_update,2,len(@SQL_update)) + ' where [维修单号]=''' + @sheetno + ''' and [回访时间] = cast ('''+ @calltimereal+''' as datetime)'
exec sp_executesql @SQL_update 抱错
从字符串向 datetime 转换时失败。该如何转换呢?sql字符串
declare @sheetno nvarchar(10)
declare @calltimereal datetime
set @SQL_update = 'update #t set ' + substring(@SQL_update,2,len(@SQL_update)) + ' where [维修单号]=''' + @sheetno + ''' and [回访时间] = cast ('''+ @calltimereal+''' as datetime)'
exec sp_executesql @SQL_update 抱错
从字符串向 datetime 转换时失败。该如何转换呢?sql字符串
set @SQL_update = 'update #t set ' + substring(@SQL_update,2,len(@SQL_update)) + ' where [维修单号]=''' + @sheetno + ''' and [回访时间] = '''+ convert(varchar,@calltimereal,121)+''' '