不允许从数据类型datetime到数据类型float

时间:2017-12-13 11:06:13

标签: sql-server

CREATE PROC proc_tblBillRegisterExtended (@FromDate AS DATETIME, @ToDate AS DATETIME, @CustomerID AS NUMERIC = NULL, @UnitLoc AS NUMERIC = NULL)
BEGIN
    INSERT INTO BillRegister 
        SELECT *  FROM BillMain BM 
            JOIN BillDetails BD ON BM.BillMainID = BD.BillMainID 
            JOIN ProductMaster PM ON BD.ProductID = PM.ProductID 
            JOIN CustomerMaster CM ON CM.CustomerID=BM.CustomerID 
            JOIN EnumCollections EC ON (BM.Status = EC.ENUMVALUE AND EC.EnumType =1) 
        WHERE 
            BM.UnitLoc = @UnitLoc 
            AND BM.BillDate BETWEEN @FromDate AND @ToDate

        UNION ALL 

        SELECT * FROM FROM BillMain BM 
            JOIN BillSampleDetails BSD ON BM.BillMainID = BSD.BillMainID 
            JOIN ListMaster LM ON BSD.SampleID = LM.ListID 
            JOIN CustomerMaster CM ON CM.CustomerID=BM.CustomerID 
            JOIN EnumCollections EC ON (BM.Status = EC.ENUMVALUE AND EC.EnumType =1)
        WHERE 
            BM.UnitLoc = @UnitLoc 
            AND BM.BillDate BETWEEN @FromDate AND @ToDate 
END

我得到了关注 不允许从数据类型datetime到数据类型float,表dbo.BillRegister',列'SGSTPer'进行隐式转换。使用CONVERT函数运行此查询。

但SGST的DataType不是sourse表中的日期时间

请帮忙。在此先感谢

1 个答案:

答案 0 :(得分:0)

好像你错过了列与值的映射。请按照BillRegister表格列以正确的顺序传递您的值。

谢谢, Amrut