-- 作者:ajie5211
-- 发布时间:2018/1/13 14:06:00
-- [求助]SQL隐式转换变显示转换语句求助
SEL ECT DISTINCT dbo.tabDIYTable372.F2591 AS 下单日期, dbo.tabDIYTable372.F2592 AS 销售单号, dbo.tabDIYTable372.F2593 AS 业务员, dbo.tabDIYTable372.F2406 AS 品名规格, dbo.订单计划生管信息.P数, dbo.tabDIYTable372.F2407 AS 数量, dbo.订单计划生管信息.总线数, CASE WHEN 生管交期 IS NULL OR 生管交期 = \'\' THEN (CASE WHEN F3337 = \'\' THEN F2408 ELSE F3337 END) ELSE 生管交期 END AS 出货日期, CASE WHEN dbo.订单计划生管信息.生管备注 IS NULL OR dbo.订单计划生管信息.生管备注 = \'\' THEN (CASE WHEN F3330 = \'\' THEN F2412 ELSE F3330 END) ELSE dbo.订单计划生管信息.生管备注 END AS 备注, dbo.tabDIYTable372.F2411 AS 客户, dbo.订单计划生管信息.组别, dbo.订单计划生管信息.塑件材料状况, dbo.订单计划生管信息.计划生产日, dbo.订单计划生管信息.完成日期, dbo.订单计划生管信息.五金材料状况, dbo.订单计划生管信息.其它备注, dbo.订单计划生管信息.延迟信息, CASE WHEN F2540 = \'已出货\' THEN \'是\' WHEN F2661 = \'已入库\' THEN \'是\' WHEN F3329 = \'\' THEN \'否\' ELSE \'是\' END AS 是否完成, dbo.tabDIYTable371.F2401 AS 合同评审单号, dbo.tabDIYTable372.F2405 AS 原序号, dbo.tabDIYTable14.F2540 AS 订单状态, CASE WHEN F3425 <> \'\' THEN 2 WHEN F2646 = \'已结束\' THEN 2 ELSE 1 END AS 判断是否已回交期, dbo.tabDIYTable14.F2661 AS 入库状态, dbo.订单计划生管信息.生管交期, dbo.订单计划生管信息.生管备注, dbo.订单计划生管信息.操作记录, dbo.tabDIYTable372.ID, _Identify FROM dbo.tabDIYTable372 INNER JOIN dbo.tabDIYTable371 ON dbo.tabDIYTable371.ID = dbo.tabDIYTable372.ID INNER JOIN dbo.tabDIYTable14 ON dbo.tabDIYTable14.F46 = dbo.tabDIYTable372.F2405 INNER JOIN dbo.tabDIYTable13 ON dbo.tabDIYTable13.ID = dbo.tabDIYTable14.ID AND dbo.tabDIYTable371.F2401 = dbo.tabDIYTable13.F39 INNER JOIN dbo.订单计划生管信息 ON dbo.订单计划生管信息.合同评审单号 = dbo.tabDIYTable371.F2401 AND dbo.订单计划生管信息.原序号 = dbo.tabDIYTable372.F2405
上面SQL语句在设置索引时,提示
------------------------------
无法对视图 \'SSMISDIYDB.dbo.SG2生管订单完工情况1\' 创建 索引,因为此视图使用了隐式转换来执行从字符串到 datetime 或 smalldatetime 的转换。请使用带确定样式值的显式转换。 (Microsoft SQL Server,错误: 10139)
------------------------------
改了几次了,都不对,希望大神告知哪里改,怎么改才对。
|