Error Message while adding Item in Item Master Data- [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting the nvarchar value 's008 01' to data type int. (CINF)

Dear Experts
I am getting the following error message while adding item in Item Master data. I have modified the following SBO_SP_transactionNotification in SQL server after that could not able to add the item
ALTER proc [dbo].[SBO_SP_TransactionNotification]
@object_type nvarchar(20),                      -- SBO Object Type
@transaction_type nchar(1),               -- [A]dd, [U]pdate, [D]elete, [C]ancel, C[L]ose
@num_of_cols_in_key int,
@list_of_key_cols_tab_del nvarchar(255),
@list_of_cols_val_tab_del nvarchar(255)
AS
begin
-- Return values
declare @error  int                       -- Result (0 for no error)
declare @error_message nvarchar (200)           -- Error string to be displayed
select @error = 0
select @error_message = N'Ok'
--    IF @OBJECT_TYPE = '59' AND (@TRANSACTION_TYPE = 'A' or @TRANSACTION_TYPE = 'U')
  BEGIN
   IF EXISTS(
    SELECT T0.Price FROM IGN1 T0
    where  IsNull(T0.Price, '0') = '0' and T0.DocEntry = @list_of_cols_val_tab_del)
   BEGIN
    SELECT @ERROR=1,@ERROR_MESSAGE='Please insert the price !'
  END
end
-- Select the return values
select @error, @error_message
end

Hi Rathna,
Just put the SP like this, without the -- before the IF. A -- marks the line as a command therefore you need to uncomment and it will work.
IF @OBJECT_TYPE = '59' AND (@TRANSACTION_TYPE = 'A' or @TRANSACTION_TYPE = 'U')
  BEGIN
   IF EXISTS(
    SELECT T0.Price FROM IGN1 T0
    where  IsNull(T0.Price, '0') = '0' and T0.DocEntry = @list_of_cols_val_tab_del)
   BEGIN
    SELECT @ERROR=1,@ERROR_MESSAGE='Please insert the price !'
  END
end
Hope it helps

Similar Messages

  • SSRS error "Conversion failed when converting the nvarchar value"

    Hi folks!
    After SCCM 2012 R2 upgrade, we have errors with self made reports:
    An error has occurred during report processing. (rsProcessingAborted)
    Cannot read the next data row for the dataset DataSet2. (rsErrorReadingNextDataRow)
    Conversion failed when converting the nvarchar value '*****' to data type int.
    I found several articles to see reporting services log file for possible WMI related errors, but none exists. SQL server is 2008R2, Runned mofcomp, and re-installed reporting services role, but problem remains.
    I traced the dataset2 query:
    SELECT
      v_Collection_Alias.CollectionID ,v_Collection_Alias.Name
    FROM fn_rbac_Collection(@UserSIDs) v_Collection_Alias
    WHERE
     v_Collection_Alias.CollectionType = 2
    Any adwice is appreciated.
    ~Tuomas.

    Hi Tuomas,
    What's the SQL Server version? To verify the the SQL Server version, please see
    http://support.microsoft.com/kb/321185
    SCCM 2012 R2 need SQL Server 2008 R2 SP1 with CU 6 or SQL Server 2008 R2 with SP2 (http://technet.microsoft.com/en-us/library/gg682077.aspx#BKMK_SupConfigSQLSrvReq).
    If the SQL meets requirement, I would suggest you submit a thread to SQL forum to deal with the sql issue.
    Thanks.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Error in MS Visual Studio 2010 : Conversion failed when converting the nvarchar value '@VATSchemeType' to data type int.

    This worked well in Visual studio 2005, but in the 2010 version it gives the above error
    SELECT VT_ClientCore.ClientCode
     ,VT_VATScheme.SchemeName
          ,CI_Entity.Name as 'Client Name'
          ,SY_Address.Address1
     ,SY_Address.Address2
    ,SY_Address.Address3
     ,SY_Address.Address1
     +(CASE WHEN (Address2 is Null OR Address2 = '') THEN '' ELSE ', ' + Address2 END)
                      + (CASE WHEN (Address3 is Null OR Address3 = '') THEN '' ELSE ', ' + Address3 END)
                      as 'Address123'
    ,SY_Address.City
    ,VT_ClientCore.VATOffice
    ,VT_ClientCore.NatureOfBusiness
    ,SY_Address.PostalCode
    ,SY_Country.Description as 'Country'
    --CASE WHEN (PostalCode IS NULL THEN)
    FROM VT_ClientCore
    LEFT JOIN VT_ClientPack ON VT_ClientCore.EntityCode#ClientCore = VT_ClientPack.EntityCode#ClientCore
    LEFT JOIN VT_VATScheme ON VT_ClientPack.VATSchemeID = VT_VATScheme.VATSchemeID
    LEFT JOIN CI_Entity ON VT_ClientCore.EntityCode#ClientCore = CI_Entity.EntityCode
    LEFT JOIN CI_ENTITYDETAIL ON VT_ClientCore.Entitycode#ClientCore = CI_EntityDetail.EntityCode
    LEFT JOIN SY_Address ON CI_ENTITYDETAIL.AddressID = SY_Address.AddressID
    LEFT JOIN SY_Country ON VT_ClientCore.CountryCode = SY_Country.CountryCode
    --WHERE VT_ClientCore.ClientCode = '23002'
    --AND SY_Address.PostalCode IS NOT NULL
    WHERE CI_ENTITYDETAIL.DETAILTYPE = 'AT'
    AND VT_VATScheme.VATSchemeTypeID IN (@VATSchemeType)
    AND VT_VATScheme.VATSchemeID IN (@VATSchemeID)
    GROUP BY VT_ClientCore.ClientCode,CI_Entity.Name,SY_Address.City,VT_ClientCore.VATOffice,VT_ClientCore.NatureOfBusiness,SY_Address.PostalCode,SY_Address.Address1,SY_Address.Address2,SY_Address.Address3,VT_VATScheme.SchemeName
    ,SY_Country.Description
    --VAT Scheme
    SELECT VATSchemeID,SchemeName
    FROM VT_VATScheme
    WHERE VATSchemeTypeID IN (@VATSchemeType)
    ORDER BY SchemeName

    How are you assigning the value to variable @VATSchemaType? Are you assigning multiple values? if yes, then you need to better join with the values by splitting the values. 
    The below would give an error (just for your reference)
    create table test_one(col1 int)
    Insert into test_one Values(1),(2)
    Declare @inta varchar(10) = '1,2'
    Select * From test_one where col1 in(@inta)
    Select * From test_one where col1 in(Select items From dbo.Split_BigInt(@inta,','))
    Drop table test_one
    function definition:
    create FUNCTION Split_BigInt
    @string VARCHAR(MAX),
    @delimiter CHAR(1)
    RETURNS @results TABLE
    items BigInt
    AS
    BEGIN
    DECLARE @index INT
    DECLARE @temp TABLE (
    items BigInt)
    IF @string = ''
    RETURN
    SET @string = LTRIM(RTRIM(@string))
    SELECT @index = Charindex(@delimiter, @string)
    WHILE @index <> 0
    BEGIN
    INSERT INTO @temp (items)
    VALUES (LTRIM(RTRIM(LEFT(@string, @index - 1))))
    SELECT @string = LTRIM(RTRIM(RIGHT(@string, Len(@string) - @index)))
    SELECT @index = Charindex(@delimiter, @string)
    END
    INSERT INTO @temp (items)
    VALUES (@string)
    INSERT INTO @results (items)
    SELECT items
    FROM @temp
    where
    items <> ''
    RETURN
    END

  • Conversion failed when converting the varchar value to data type int error

    Hi, I am working on a report which is off of survey information and I am using dynamic pivot on multiple columns.
    I have questions like Did you use this parking tag for more than 250 hours? If yes specify number of hours.
    and the answers could be No, 302, 279, No and so on....
    All these answers are of varchar datatype and all this data comes from a partner application where we consume this data for internal reporting.
    When I am doing dynamic pivot I get the below error.
    Error: Conversion failed when converting the varchar value 'No' to data type int.
    Query
    DECLARE @Cols1 VARCHAR(MAX), @Cols0 VARCHAR(MAX), @Total VARCHAR(MAX), @SQL VARCHAR(MAX)
    SELECT @Cols1 = STUFF((SELECT ', ' + QUOTENAME(Question) FROM Question GROUP BY Question FOR XML PATH('')),1,2,'')
    SELECT @Cols0 = (SELECT ', COALESCE(' + QUOTENAME(Question) + ',0) as ' + QUOTENAME(Question) FROM Question GROUP BY Question FOR XML PATH(''))
    SET @SQL = 'SELECT QID, QNAME' + @Cols0 + '
    FROM (SELECT QID, QNAME, ANSWERS, Question
    FROM Question) T
    PIVOT (MAX(ANSWERS) FOR Question IN ('+@Cols1+')) AS P'
    EXECUTE (@SQL)
    I am using SQL Server 2008 R2.
    Please guide me to resolve this.
    Thanks in advance..........
    Ione

    create table questions (QID int, QNAME varchar(50), ANSWERS varchar(500), Question varchar(50))
    Insert into questions values(1,'a','b','c'), (2,'a2','b2','c2')
    DECLARE @Cols1 VARCHAR(MAX), @Cols0 VARCHAR(MAX), @Total VARCHAR(MAX), @SQL VARCHAR(MAX)
    SELECT @Cols1 = STUFF((SELECT ', ' + QUOTENAME(Question) FROM Questions GROUP BY Question FOR XML PATH('')),1,2,'')
    SELECT @Cols0 = (SELECT ', COALESCE(' + QUOTENAME(Question) + ',''0'') as ' + QUOTENAME(Question) FROM Questions GROUP BY Question FOR XML PATH(''))
    SET @SQL = 'SELECT QID, QNAME' + @Cols0 + '
    FROM (SELECT QID, QNAME, ANSWERS, Question
    FROM Questions) T
    PIVOT (MAX(ANSWERS) FOR Question IN ('+@Cols1+')) AS P'
    EXECUTE (@SQL)
    drop table questions

  • SQL Error-Converting the nvarchar value to datatype int

    I am having error when I use the range of july but other date range are okay.
    here is error:
    Msg 245, Level 16, State 1, Line 1
    Conversion failed when converting the nvarchar value 'Vital Ventures Mgt. Corp.' to data type int.
    Select A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P From (SELECT CONVERT(nvarchar,a.TaxDate,101) A,a.LicTradNum B,a.CardCode C,ISNULL(a.CardName,' ') D,Case When a.DocType='I' Then a.Comments When a.DocType='S' then (Select top 1 (dscription) from INV1 where docEntry=d.docentry and VatGroup=d.VatGroup)End E,ISNULL(f.SeriesName,'')+Cast(a.DocNum as nvarchar) F,Case When a.DocType='I' Then a.Max1099 When a.DocType='S' Then SUM(d.PriceAfVat) End G,0 H 
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.Max1099-a.VatSum When a.DocType='S' Then SUM(d.LineTotal) End Else 0 End I 
                ,Case when e.Name LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.Max1099-a.VatSum When a.DocType='S' Then SUM(d.LineTotal) End Else 0 End J 
                ,Case when e.Name LIKE '%VAT EXEMPT' Then Case When a.DocType='I' Then a.Max1099-a.VatSum When a.DocType='S' Then SUM(d.LineTotal) End Else 0 End K 
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.vatSum When a.DocType='S' Then SUM(d.vatSum) End Else 0 End L,'' M,a.DocType N,'SI' O,a.DocNum P 
                from OINV a inner join OCRD c on a.CardCode=c.CardCode inner join INV1 d on a.DocEntry=d.DocEntry left join NNM1 f on  a.Series=f.Series 
                inner join OVTG e on d.VatGroup=e.Code Where a.DocDate Between '07/01/2014' AND '07/31/2014' and (f.SeriesName = 'SI' or a.Series = '-1') GROUP BY d.VatGroup,CONVERT(nvarchar,a.TaxDate,101),a.LicTradNum,a.CardCode, a.CardName,a.Doctype,a.comments,a.docnum,a.Max1099,e.name,a.vatsum,d.docentry,ISNULL(f.SeriesName,'') 
                UNION ALL 
                SELECT CONVERT(nvarchar,a.TaxDate,101) A,a.LicTradNum B,a.CardCode C,ISNULL(a.CardName,' ') D,Case When a.DocType='I' Then a.Comments When a.DocType='S' Then (Select top 1 (dscription) from RIN1 where docEntry=d.docentry and VatGroup=d.VatGroup) End E,ISNULL(g.SeriesName,'')+Cast(a.DocNum as nvarchar) F,Case When a.DocType='I' Then a.Max1099*-1 When a.DocType='S' Then SUM(d.PriceAfVat*-1) End G,Case When f.AcctName='SALES DISCOUNTS (Trading)' Then SUM(d.LineTotal) Else 0 End H 
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then (a.Max1099-a.VatSum)*-1 When a.DocType='S' Then SUM(d.LineTotal*-1) End Else 0 End I 
                ,Case when e.Name LIKE '%Zero Rated' Then Case When a.DocType='I' Then (a.Max1099-a.VatSum)*-1 When a.DocType='S' Then SUM(d.LineTotal*-1) End Else 0 End J 
                ,Case when e.Name LIKE '%VAT EXEMPT' Then Case When a.DocType='I' Then (a.Max1099-a.VatSum)*-1 When a.DocType='S' Then SUM(d.LineTotal*-1) End Else 0 End K 
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.vatSum*-1 When a.DocType='S' Then SUM(d.vatSum*-1) End Else 0 End L,'' M,a.DocType N,'SR/D' O,a.DocNum P 
                from ORIN a inner join OCRD c on a.CardCode=c.CardCode inner join RIN1 d on a.DocEntry=d.DocEntry inner join OACT f ON d.acctCode=f.acctCode left join NNM1 g on a.Series=g.Series  
               inner join OVTG e on d.VatGroup=e.Code Where a.DocDate Between '07/01/2014' AND '07/31/2014' and (g.SeriesName = 'SR/D' or a.Series = '-1') GROUP BY d.VatGroup,CONVERT(nvarchar,a.TaxDate,101),a.LicTradNum,a.CardCode, a.CardName,a.Doctype,a.comments,a.docnum,a.Max1099,e.name,a.vatsum,d.docentry,f.AcctName,ISNULL(g.SeriesName,'') 
                UNION ALL SELECT CONVERT(nvarchar,a.TaxDate,101) A,f.LicTradNum B,c.CardCode C,ISNULL(c.CardName,' ') D,c.comments E,'OR'+Cast(a.Ref1 as nvarchar) F,Case When d.Debit<>0 Then SUM(d.basesum + d.debit)*-1 Else SUM(d.basesum + d.credit) End G,0 H 
                ,Case When d.debit<>0 then d.BaseSum*-1 Else d.BaseSum End I,0 J,0 K,Case When d.debit<>0 then d.debit*-1 Else d.Credit End L,'' M,'S' N,'OR' O,a.Ref1 P 
                from OJDT a inner join ORCT c on a.Ref1=c.DocNum inner join JDT1 d on a.TransId=d.TransId Inner Join OCRD f on c.CardCode=f.Cardcode 
                inner join OVTG e on d.VatGroup=e.Code Where a.TaxDate Between '07/01/2014' AND '07/31/2014' and d.VatGroup='Output-S' and a.TransType=30 GROUP BY d.VatGroup,CONVERT(nvarchar,a.TaxDate,101),f.LicTradNum,c.CardCode, c.CardName,c.comments,a.Ref1,a.loctotal,d.credit,d.debit,d.baseSum 
                ) A Group By A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P Order By O,P

    Hi Raphael...
    Try This
    Select A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P From (SELECT a.TaxDate A,a.LicTradNum B,a.CardCode C,ISNULL(a.CardName,' ') D,Case When a.DocType='I' Then a.Comments When a.DocType='S' then (Select top 1 (dscription) from INV1 where docEntry=d.docentry and VatGroup=d.VatGroup)End E,ISNULL(f.SeriesName,'')+Cast(a.DocNum as nvarchar) F,Case When a.DocType='I' Then a.Max1099 When a.DocType='S' Then SUM(d.PriceAfVat) End G,0 H
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.Max1099-a.VatSum When a.DocType='S' Then SUM(d.LineTotal) End Else 0 End I
                ,Case when e.Name LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.Max1099-a.VatSum When a.DocType='S' Then SUM(d.LineTotal) End Else 0 End J
                ,Case when e.Name LIKE '%VAT EXEMPT' Then Case When a.DocType='I' Then a.Max1099-a.VatSum When a.DocType='S' Then SUM(d.LineTotal) End Else 0 End K
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.vatSum When a.DocType='S' Then SUM(d.vatSum) End Else 0 End L,'' M,a.DocType N,'SI' O,a.DocNum P
                from OINV a inner join OCRD c on a.CardCode=c.CardCode inner join INV1 d on a.DocEntry=d.DocEntry left join NNM1 f on  a.Series=f.Series
                inner join OVTG e on d.VatGroup=e.Code Where a.DocDate Between '07/01/2014' AND '07/31/2014' and (f.SeriesName = 'SI' or a.Series = '-1') GROUP BY d.VatGroup,a.TaxDate,a.LicTradNum,a.CardCode, a.CardName,a.Doctype,a.comments,a.docnum,a.Max1099,e.name,a.vatsum,d.docentry,ISNULL(f.SeriesName,'')
                UNION ALL
                SELECT a.TaxDate A,a.LicTradNum B,a.CardCode C,ISNULL(a.CardName,' ') D,Case When a.DocType='I' Then a.Comments When a.DocType='S' Then (Select top 1 (dscription) from RIN1 where docEntry=d.docentry and VatGroup=d.VatGroup) End E,ISNULL(g.SeriesName,'')+Cast(a.DocNum as nvarchar) F,Case When a.DocType='I' Then a.Max1099*-1 When a.DocType='S' Then SUM(d.PriceAfVat*-1) End G,Case When f.AcctName='SALES DISCOUNTS (Trading)' Then SUM(d.LineTotal) Else 0 End H
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then (a.Max1099-a.VatSum)*-1 When a.DocType='S' Then SUM(d.LineTotal*-1) End Else 0 End I
                ,Case when e.Name LIKE '%Zero Rated' Then Case When a.DocType='I' Then (a.Max1099-a.VatSum)*-1 When a.DocType='S' Then SUM(d.LineTotal*-1) End Else 0 End J
                ,Case when e.Name LIKE '%VAT EXEMPT' Then Case When a.DocType='I' Then (a.Max1099-a.VatSum)*-1 When a.DocType='S' Then SUM(d.LineTotal*-1) End Else 0 End K
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.vatSum*-1 When a.DocType='S' Then SUM(d.vatSum*-1) End Else 0 End L,'' M,a.DocType N,'SR/D' O,a.DocNum P
                from ORIN a inner join OCRD c on a.CardCode=c.CardCode inner join RIN1 d on a.DocEntry=d.DocEntry inner join OACT f ON d.acctCode=f.acctCode left join NNM1 g on a.Series=g.Series 
               inner join OVTG e on d.VatGroup=e.Code Where a.DocDate Between '07/01/2014' AND '07/31/2014' and (g.SeriesName = 'SR/D' or a.Series = '-1') GROUP BY d.VatGroup,a.TaxDate,a.LicTradNum,a.CardCode, a.CardName,a.Doctype,a.comments,a.docnum,a.Max1099,e.name,a.vatsum,d.docentry,f.AcctName,ISNULL(g.SeriesName,'')
                UNION ALL SELECT a.TaxDate A,f.LicTradNum B,c.CardCode C,ISNULL(c.CardName,' ') D,c.comments E,'OR'+Cast(a.Ref1 as nvarchar) F,Case When d.Debit<>0 Then SUM(d.basesum + d.debit)*-1 Else SUM(d.basesum + d.credit) End G,0 H
                ,Case When d.debit<>0 then d.BaseSum*-1 Else d.BaseSum End I,0 J,0 K,Case When d.debit<>0 then d.debit*-1 Else d.Credit End L,'' M,'S' N,'OR' O,a.Ref1 P
                from OJDT a inner join ORCT c on a.Ref1=c.DocNum inner join JDT1 d on a.TransId=d.TransId Inner Join OCRD f on c.CardCode=f.Cardcode
                inner join OVTG e on d.VatGroup=e.Code Where a.TaxDate Between '07/01/2014' AND '07/31/2014' and d.VatGroup='Output-S' and a.TransType=30 GROUP BY d.VatGroup,a.TaxDate,f.LicTradNum,c.CardCode, c.CardName,c.comments,a.Ref1,a.loctotal,d.credit,d.debit,d.baseSum
                ) A Group By A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P Order By O,P
    Regards
    Kennedy

  • [Microsoft][SQL Server Native Client 11.0][SQL Server]The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.  'Items' (OITM) (OITM)

    Dear Experts,
    i am getting the below error when i was giving * (Star) to view all the items in DB
    [Microsoft][SQL Server Native Client 11.0][SQL Server]The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.  'Items' (OITM) (OITM)
    As i was searching individually it is working fine
    can any one help me how to find this..
    Regards,
    Meghanath.S

    Dear Nithi Anandham,
    i am not having any query while finding all the items in item master data i am giving find mode and in item code i was trying to type *(Star) and enter while typing enter the above issue i was facing..
    Regards,
    Meghanath

  • Error in query: [Microsoft][SQL Server Native Client 10.0][SQL Server]Must specify table to select from. '' (SWEI)

    Hi All
    below query giving me error in query generator but working well in Sql server.
    error: [Microsoft][SQL Server Native Client 10.0][SQL Server]Must specify table to select from. '' (SWEI)
    Select
    T1.U_grp01 As 'BA',T3.DocDate As 'Posting Date',Month(T3.DocDate) As 'PostMonth',Year(T3.DocDate) As 'PostYear',
    'AR Invoice' As 'Type',T3.DocNum As 'Doc No',T3.CardCode As 'Cust. Code',T3.CardName As 'Cust. Name',T5.SlpName As 'Sale Emp. Name',
    T4.IndustryC As 'Channel Type',T6.CityB As 'BillToCity',T7.Name As 'BillToState',T6.CityS As 'ShipToCity',T8.Name As 'ShipToState',
    T4.U_Une_Zone As 'Zone',
    T2.ItmsGrpNam As 'L1',T0.LineNum As 'Row No',T0.ItemCode As 'ItemCode',T0.Dscription As 'Item Name',t0.whscode,
    T0.Quantity As 'Quantity',T0.StockPrice As 'COGS Price',IsNull(Sum(T0.Quantity * T0.StockPrice),0) As 'COGS Value',T0.VatSum As 'Tax Amount',
    IsNull((Case When T3.DocType='I' Then (Case  When T0.Currency = 'INR' Then T0.PriceBefDi Else (T0.PriceBefDi * T0.Rate) End) Else T0.Price End) ,0) As 'Sales Price',
    IsNull((Case When T3.DocType='I' Then (Case  When T0.Currency = 'INR' Then T0.INMPrice Else (T0.INMPrice * T0.Rate) End) Else T0.Price End) ,0) As 'Sales Price',
    IsNull((Case When T3.DocType='I' Then (Case  When T0.Currency = 'INR' Then Sum(T0.Quantity * T0.INMPrice) Else Sum(T0.Quantity * T0.INMPrice * T0.Rate) End) Else T0.LineTotal End) ,0) As 'Sales Value',t9.linetotal as 'Freight',
    T3.DocType As 'DocType',
    (SELECT DISTINCT ISNULL (SUM(INV4.TaxSum),0)
    FROM INV4
    WHERE INV4.StaType = -90
    AND INV4.DocEntry = T3.DocEntry
    AND INV4.LineNum = T0.LineNum) AS 'BED',
    (SELECT DISTINCT ISNULL (SUM(INV4.TaxSum),0)
    FROM INV4
    WHERE INV4.StaType = -60
    AND INV4.DocEntry = T3.DocEntry
    AND INV4.LineNum = T0.LineNum) AS 'Cess',
    (SELECT DISTINCT ISNULL (SUM(INV4.TaxSum),0)
    FROM INV4
    WHERE INV4.StaType = 9
    AND INV4.DocEntry = T3.DocEntry
    AND INV4.LineNum = T0.LineNum) AS 'HeCess',
    (SELECT DISTINCT ISNULL (SUM(INV4.TaxSum),0)
    FROM INV4
    WHERE (INV4.StaType = 1 or inv4.staType = 8)
    AND INV4.DocEntry = T3.DocEntry
    AND INV4.LineNum = T0.LineNum) AS 'VAT',
    (SELECT DISTINCT ISNULL (SUM(INV4.TaxSum),0)
    FROM INV4
    WHERE INV4.StaType = 8
    AND INV4.DocEntry = T3.DocEntry
    AND INV4.LineNum = T0.LineNum) AS 'CST'
    From INV1 T0
    Left Join OITM T1 On T1.ItemCode=T0.ItemCode
    Left Join OITB T2 On T2.ItmsGrpCod=T1.ItmsGrpCod
    Left Join OINV T3 On T3.DocEntry=T0.DocEntry
    Left Join OCRD T4 On T4.CardCode=T3.CardCode
    Left Join OSLP T5 On T5.SlpCode=T4.SlpCode
    Left Join INV12 T6 On T6.DocEntry=T0.DocEntry
    Left Join OCST T7 On T7.Code=T6.StateB and T7.Country='IN'
    Left Join OCST T8 On T8.Code=T6.StateS and T8.Country='IN'
    left join inv3 t9 on t9.docentry = t3.docentry
    WHERE T3.[DocDate] >= [%0] and T3.[DocDate] <= [%1] and t3.U_UNE_GCAT = '2'
    Group By T1.U_grp01,T3.DocEntry,T3.DocNum,T3.DocDate,T0.LineNum,T3.CardCode,T3.CardName,T5.SlpName,T4.IndustryC,T4.U_Une_Zone,
    T6.CityB,T7.Name,T6.CityS,T8.Name,T0.VatSum,T0.Currency,T0.Rate,T3.DocType,T0.Price,T0.LineTotal,
    T2.ItmsGrpNam,T0.ItemCode,T0.Dscription,T0.StockPrice,T0.INMPrice,T0.PriceBefDi,T0.Quantity,t9.linetotal,t0.WhsCode
    Union All
    Select
    T1.U_grp01 As 'BA',T3.DocDate As 'Posting Date',Month(T3.DocDate) As 'PostMonth',Year(T3.DocDate) As 'PostYear',
    'AR Invoice' As 'Type',T3.DocNum As 'Doc No',T3.CardCode As 'Cust. Code',T3.CardName As 'Cust. Name',T5.SlpName As 'Sale Emp. Name',
    T4.IndustryC As 'Channel Type',T6.CityB As 'BillToCity',T7.Name As 'BillToState',T6.CityS As 'ShipToCity',T8.Name As 'ShipToState',
    T4.U_Une_Zone As 'Zone',
    T2.ItmsGrpNam As 'L1',T0.LineNum As 'Row No',T0.ItemCode As 'ItemCode',T0.Dscription As 'Item Name',t0.whscode,
    T0.Quantity As 'Quantity',T0.StockPrice As 'COGS Price',IsNull(Sum(T0.Quantity * T0.StockPrice),0) As 'COGS Value',T0.VatSum As 'Tax Amount',
    IsNull((Case When T3.DocType='I' Then (Case  When T0.Currency = 'INR' Then T0.PriceBefDi Else (T0.PriceBefDi * T0.Rate) End) Else T0.Price End) ,0) As 'Sales Price',
    IsNull((Case When T3.DocType='I' Then (Case  When T0.Currency = 'INR' Then T0.INMPrice Else (T0.INMPrice * T0.Rate) End) Else T0.Price End) ,0) As 'Sales Price',
    IsNull((Case When T3.DocType='I' Then (Case  When T0.Currency = 'INR' Then Sum(T0.Quantity * T0.INMPrice) Else Sum(T0.Quantity * T0.INMPrice * T0.Rate) End) Else T0.LineTotal End) ,0) As 'Sales Value',t9.linetotal as 'Freight',
    T3.DocType As 'DocType',
    (SELECT DISTINCT ISNULL (SUM(rin4.TaxSum),0)
    FROM rin4
    WHERE rin4.StaType = -90
    AND rin4.DocEntry = T3.DocEntry
    AND rin4.LineNum = T0.LineNum) AS 'BED',
    (SELECT DISTINCT ISNULL (SUM(rin4.TaxSum),0)
    FROM rin4
    WHERE rin4.StaType = -60
    AND rin4.DocEntry = T3.DocEntry
    AND rin4.LineNum = T0.LineNum) AS 'Cess',
    (SELECT DISTINCT ISNULL (SUM(rin4.TaxSum),0)
    FROM rin4
    WHERE rin4.StaType = 9
    AND rin4.DocEntry = T3.DocEntry
    AND rin4.LineNum = T0.LineNum) AS 'HeCess',
    (SELECT DISTINCT ISNULL (SUM(rin4.TaxSum),0)
    FROM rin4
    WHERE (rin4.StaType = 1 or rin4.staType = 8)
    AND rin4.DocEntry = T3.DocEntry
    AND rin4.LineNum = T0.LineNum) AS 'VAT',
    (SELECT DISTINCT ISNULL (SUM(rin4.TaxSum),0)
    FROM rin4
    WHERE rin4.StaType = 8
    AND rin4.DocEntry = T3.DocEntry
    AND rin4.LineNum = T0.LineNum) AS 'CST'
    From rin1 T0
    Left Join OITM T1 On T1.ItemCode=T0.ItemCode
    Left Join OITB T2 On T2.ItmsGrpCod=T1.ItmsGrpCod
    Left Join Orin T3 On T3.DocEntry=T0.DocEntry
    Left Join OCRD T4 On T4.CardCode=T3.CardCode
    Left Join OSLP T5 On T5.SlpCode=T4.SlpCode
    Left Join rin12 T6 On T6.DocEntry=T0.DocEntry
    Left Join OCST T7 On T7.Code=T6.StateB and T7.Country='IN'
    Left Join OCST T8 On T8.Code=T6.StateS and T8.Country='IN'
    left join rin3 t9 on t9.docentry = t3.docentry
    WHERE T3.[DocDate] >= [%0] and T3.[DocDate] <= [%1] and t3.U_UNE_GCAT = '2'
    Group By T1.U_grp01,T3.DocEntry,T3.DocNum,T3.DocDate,T0.LineNum,T3.CardCode,T3.CardName,T5.SlpName,T4.IndustryC,T4.U_Une_Zone,
    T6.CityB,T7.Name,T6.CityS,T8.Name,T0.VatSum,T0.Currency,T0.Rate,T3.DocType,T0.Price,T0.LineTotal,
    T2.ItmsGrpNam,T0.ItemCode,T0.Dscription,T0.StockPrice,T0.INMPrice,T0.PriceBefDi,T0.Quantity,t9.linetotal,t0.WhsCode
    Thanks in Advance

    Hi deepak..
    try this
    /* SELECT FROM OSRT P1 */
    DECLARE @FROM AS DATE
    /* WHERE */
    SET @FROM = /* P1.FromDate */ '[%1]'
    /* SELECT FROM OSRT P2 */
    DECLARE @TO AS DATE
    /* WHERE */
    SET @TO = /* P2.ToDate */ '[%2]';
    SELECT T1.U_grp01 AS 'BA',
           T3.DocDate AS 'Posting Date',
           MONTH(T3.DocDate) AS 'PostMonth',
           YEAR(T3.DocDate) AS 'PostYear',
           'AR Invoice' AS 'Type',
           T3.DocNum AS 'Doc No',
           T3.CardCode AS 'Cust. Code',
           T3.CardName AS 'Cust. Name',
           T5.SlpName AS 'Sale Emp. Name',
           T4.IndustryC AS 'Channel Type',
           T6.CityB AS 'BillToCity',
           T7.Name AS 'BillToState',
           T6.CityS AS 'ShipToCity',
           T8.Name AS 'ShipToState',
           T4.U_Une_Zone AS 'Zone',
           T2.ItmsGrpNam AS 'L1',
           T0.LineNum AS 'Row No',
           T0.ItemCode AS 'ItemCode',
           T0.Dscription AS 'Item Name',
           t0.whscode,
           T0.Quantity AS 'Quantity',
           T0.StockPrice AS 'COGS Price',
           ISNULL(SUM(T0.Quantity * T0.StockPrice), 0) AS 'COGS Value',
           T0.VatSum AS 'Tax Amount',
           ISNULL(
                   CASE
                        WHEN T3.DocType = 'I' THEN (
                                 CASE
                                      WHEN T0.Currency = 'INR' THEN T0.PriceBefDi
                                      ELSE (T0.PriceBefDi * T0.Rate)
                                 END
                        ELSE T0.Price
                   END
               0
           ) AS 'Sales Price',
           ISNULL(
                   CASE
                        WHEN T3.DocType = 'I' THEN (
                                 CASE
                                      WHEN T0.Currency = 'INR' THEN T0.INMPrice
                                      ELSE (T0.INMPrice * T0.Rate)
                                 END
                        ELSE T0.Price
                   END
               0
           ) AS 'Sales Price',
           ISNULL(
                   CASE
                        WHEN T3.DocType = 'I' THEN (
                                 CASE
                                      WHEN T0.Currency = 'INR' THEN SUM(T0.Quantity * T0.INMPrice)
                                      ELSE SUM(T0.Quantity * T0.INMPrice * T0.Rate)
                                 END
                        ELSE T0.LineTotal
                   END
               0
           ) AS 'Sales Value',
           t9.linetotal AS 'Freight',
           T3.DocType AS 'DocType',
               SELECT DISTINCT ISNULL(SUM(INV4.TaxSum), 0)
               FROM   INV4
               WHERE  INV4.StaType = -90
                      AND INV4.DocEntry = T3.DocEntry
                      AND INV4.LineNum = T0.LineNum
           ) AS 'BED',
               SELECT DISTINCT ISNULL(SUM(INV4.TaxSum), 0)
               FROM   INV4
               WHERE  INV4.StaType = -60
                      AND INV4.DocEntry = T3.DocEntry
                      AND INV4.LineNum = T0.LineNum
           ) AS 'Cess',
               SELECT DISTINCT ISNULL(SUM(INV4.TaxSum), 0)
               FROM   INV4
               WHERE  INV4.StaType = 9
                      AND INV4.DocEntry = T3.DocEntry
                      AND INV4.LineNum = T0.LineNum
           ) AS 'HeCess',
               SELECT DISTINCT ISNULL(SUM(INV4.TaxSum), 0)
               FROM   INV4
               WHERE  (INV4.StaType = 1 OR inv4.staType = 8)
                      AND INV4.DocEntry = T3.DocEntry
                      AND INV4.LineNum = T0.LineNum
           ) AS 'VAT',
               SELECT DISTINCT ISNULL(SUM(INV4.TaxSum), 0)
               FROM   INV4
               WHERE  INV4.StaType = 8
                      AND INV4.DocEntry = T3.DocEntry
                      AND INV4.LineNum = T0.LineNum
           ) AS 'CST'
    FROM   INV1 T0
           LEFT JOIN OITM T1
                ON  T1.ItemCode = T0.ItemCode
           LEFT JOIN OITB T2
                ON  T2.ItmsGrpCod = T1.ItmsGrpCod
           LEFT JOIN OINV T3
                ON  T3.DocEntry = T0.DocEntry
           LEFT JOIN OCRD T4
                ON  T4.CardCode = T3.CardCode
           LEFT JOIN OSLP T5
                ON  T5.SlpCode = T4.SlpCode
           LEFT JOIN INV12 T6
                ON  T6.DocEntry = T0.DocEntry
           LEFT JOIN OCST T7
                ON  T7.Code = T6.StateB
                AND T7.Country = 'IN'
           LEFT JOIN OCST T8
                ON  T8.Code = T6.StateS
                AND T8.Country = 'IN'
           LEFT JOIN inv3 t9
                ON  t9.docentry = t3.docentry
    WHERE  T3.[DocDate] >= @FROM
           AND T3.[DocDate] <= @TO
           AND t3.U_UNE_GCAT = '2'
    GROUP BY
           T1.U_grp01,
           T3.DocEntry,
           T3.DocNum,
           T3.DocDate,
           T0.LineNum,
           T3.CardCode,
           T3.CardName,
           T5.SlpName,
           T4.IndustryC,
           T4.U_Une_Zone,
           T6.CityB,
           T7.Name,
           T6.CityS,
           T8.Name,
           T0.VatSum,
           T0.Currency,
           T0.Rate,
           T3.DocType,
           T0.Price,
           T0.LineTotal,
           T2.ItmsGrpNam,
           T0.ItemCode,
           T0.Dscription,
           T0.StockPrice,
           T0.INMPrice,
           T0.PriceBefDi,
           T0.Quantity,
           t9.linetotal,
           t0.WhsCode
    UNION ALL
    SELECT T1.U_grp01 AS 'BA',
           T3.DocDate AS 'Posting Date',
           MONTH(T3.DocDate) AS 'PostMonth',
           YEAR(T3.DocDate) AS 'PostYear',
           'AR Invoice' AS 'Type',
           T3.DocNum AS 'Doc No',
           T3.CardCode AS 'Cust. Code',
           T3.CardName AS 'Cust. Name',
           T5.SlpName AS 'Sale Emp. Name',
           T4.IndustryC AS 'Channel Type',
           T6.CityB AS 'BillToCity',
           T7.Name AS 'BillToState',
           T6.CityS AS 'ShipToCity',
           T8.Name AS 'ShipToState',
           T4.U_Une_Zone AS 'Zone',
           T2.ItmsGrpNam AS 'L1',
           T0.LineNum AS 'Row No',
           T0.ItemCode AS 'ItemCode',
           T0.Dscription AS 'Item Name',
           t0.whscode,
           T0.Quantity AS 'Quantity',
           T0.StockPrice AS 'COGS Price',
           ISNULL(SUM(T0.Quantity * T0.StockPrice), 0) AS 'COGS Value',
           T0.VatSum AS 'Tax Amount',
           ISNULL(
                   CASE
                        WHEN T3.DocType = 'I' THEN (
                                 CASE
                                      WHEN T0.Currency = 'INR' THEN T0.PriceBefDi
                                      ELSE (T0.PriceBefDi * T0.Rate)
                                 END
                        ELSE T0.Price
                   END
               0
           ) AS 'Sales Price',
           ISNULL(
                   CASE
                        WHEN T3.DocType = 'I' THEN (
                                 CASE
                                      WHEN T0.Currency = 'INR' THEN T0.INMPrice
                                      ELSE (T0.INMPrice * T0.Rate)
                                 END
                        ELSE T0.Price
                   END
               0
           ) AS 'Sales Price',
           ISNULL(
                   CASE
                        WHEN T3.DocType = 'I' THEN (
                                 CASE
                                      WHEN T0.Currency = 'INR' THEN SUM(T0.Quantity * T0.INMPrice)
                                      ELSE SUM(T0.Quantity * T0.INMPrice * T0.Rate)
                                 END
                        ELSE T0.LineTotal
                   END
               0
           ) AS 'Sales Value',
           t9.linetotal AS 'Freight',
           T3.DocType AS 'DocType',
               SELECT DISTINCT ISNULL(SUM(rin4.TaxSum), 0)
               FROM   rin4
               WHERE  rin4.StaType = -90
                      AND rin4.DocEntry = T3.DocEntry
                      AND rin4.LineNum = T0.LineNum
           ) AS 'BED',
               SELECT DISTINCT ISNULL(SUM(rin4.TaxSum), 0)
               FROM   rin4
               WHERE  rin4.StaType = -60
                      AND rin4.DocEntry = T3.DocEntry
                      AND rin4.LineNum = T0.LineNum
           ) AS 'Cess',
               SELECT DISTINCT ISNULL(SUM(rin4.TaxSum), 0)
               FROM   rin4
               WHERE  rin4.StaType = 9
                      AND rin4.DocEntry = T3.DocEntry
                      AND rin4.LineNum = T0.LineNum
           ) AS 'HeCess',
               SELECT DISTINCT ISNULL(SUM(rin4.TaxSum), 0)
               FROM   rin4
               WHERE  (rin4.StaType = 1 OR rin4.staType = 8)
                      AND rin4.DocEntry = T3.DocEntry
                      AND rin4.LineNum = T0.LineNum
           ) AS 'VAT',
               SELECT DISTINCT ISNULL(SUM(rin4.TaxSum), 0)
               FROM   rin4
               WHERE  rin4.StaType = 8
                      AND rin4.DocEntry = T3.DocEntry
                      AND rin4.LineNum = T0.LineNum
           ) AS 'CST'
    FROM   rin1 T0
           LEFT JOIN OITM T1
                ON  T1.ItemCode = T0.ItemCode
           LEFT JOIN OITB T2
                ON  T2.ItmsGrpCod = T1.ItmsGrpCod
           LEFT JOIN [dbo].[Orin] T3
                ON  T3.DocEntry = T0.DocEntry
           LEFT JOIN OCRD T4
                ON  T4.CardCode = T3.CardCode
           LEFT JOIN OSLP T5
                ON  T5.SlpCode = T4.SlpCode
           LEFT JOIN rin12 T6
                ON  T6.DocEntry = T0.DocEntry
           LEFT JOIN OCST T7
                ON  T7.Code = T6.StateB
                AND T7.Country = 'IN'
           LEFT JOIN OCST T8
                ON  T8.Code = T6.StateS
                AND T8.Country = 'IN'
           LEFT JOIN rin3 t9
                ON  t9.docentry = t3.docentry
    WHERE  T3.[DocDate] >= @FROM
           AND T3.[DocDate] <= @TO
           AND t3.U_UNE_GCAT = '2'
    GROUP BY
           T1.U_grp01,
           T3.DocEntry,
           T3.DocNum,
           T3.DocDate,
           T0.LineNum,
           T3.CardCode,
           T3.CardName,
           T5.SlpName,
           T4.IndustryC,
           T4.U_Une_Zone,
           T6.CityB,
           T7.Name,
           T6.CityS,
           T8.Name,
           T0.VatSum,
           T0.Currency,
           T0.Rate,
           T3.DocType,
           T0.Price,
           T0.LineTotal,
           T2.ItmsGrpNam,
           T0.ItemCode,
           T0.Dscription,
           T0.StockPrice,
           T0.INMPrice,
           T0.PriceBefDi,
           T0.Quantity,
           t9.linetotal,
           t0.WhsCode
    rgds
    Kennedy

  • Error "Conversion failed when converting date and/or time from character string" to execute one query in sql 2008 r2, run ok in 2005.

    I have  a table-valued function that run in sql 2005 and when try to execute in sql 2008 r2, return the next "Conversion failed when converting date and/or time from character string".
    USE [Runtime]
    GO
    /****** Object:  UserDefinedFunction [dbo].[f_Pinto_Graf_P_Opt]    Script Date: 06/11/2013 08:47:47 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE   FUNCTION [dbo].[f_Pinto_Graf_P_Opt] (@fechaInicio datetime, @fechaFin datetime)  
    -- Declaramos la tabla "@Produc_Opt" que será devuelta por la funcion
    RETURNS @Produc_Opt table ( Hora datetime,NSACOS int, NSACOS_opt int)
    AS  
    BEGIN 
    -- Crea el Cursor
    DECLARE cursorHora CURSOR
    READ_ONLY
    FOR SELECT DateTime, Value FROM f_PP_Graficas ('Pinto_CON_SACOS',@fechaInicio, @fechaFin,'Pinto_PRODUCTO')
    -- Declaracion de variables locales
    DECLARE @produc_opt_hora int
    DECLARE @produc_opt_parc int
    DECLARE @nsacos int
    DECLARE @time_parc datetime
    -- Inicializamos VARIABLES
    SET @produc_opt_hora = (SELECT * FROM f_Valor (@fechaFin,'Pinto_PRODUC_OPT'))
    -- Abre y se crea el conjunto del cursor
    OPEN cursorHora
    -- Comenzamos los calculos 
    FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
    /************  BUCLE WHILE QUE SE VA A MOVER A TRAVES DEL CURSOR  ************/
    WHILE (@@fetch_status <> -1)
    BEGIN
    IF (@@fetch_status = -2)
    BEGIN
    -- Terminamos la ejecucion 
    BREAK
    END
    -- REALIZAMOS CÁLCULOS
    SET @produc_opt_parc = (SELECT dbo.f_P_Opt_Parc (@fechaInicio,@time_parc,@produc_opt_hora))
    -- INSERTAMOS VALORES EN LA TABLA
    INSERT @Produc_Opt VALUES (@time_parc,@nsacos, @produc_opt_parc)
    -- Avanzamos el cursor
    FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
    END
    /************  FIN DEL BUCLE QUE SE MUEVE A TRAVES DEL CURSOR  ***************/
    -- Cerramos el cursor
    CLOSE cursorHora
    -- Liberamos  los cursores
    DEALLOCATE cursorHora
    RETURN 
    END

    You can search the forums for that error message and find previous discussions - they all boil down to the same problem.  Somewhere in your query that calls this function, the code invoked implicitly converts from string to date/datetime.  In general,
    this works in any version of sql server if the runtime settings are correct for the format of the string data.  The fact that it works in one server and not in another server suggests that the query executes with different settings - and I'll assume for
    the moment that the format of the data involved in this conversion is consistent within the database/resultset and consistent between the 2 servers. 
    I suggest you read Tibor's guide to the datetime datatype (via the link to his site below) first - then go find the actual code that performs this conversion.  It may not be in the function you posted, since that function also executes other functions. 
    You also did not post the query that calls this function, so this function may not, in fact, be the source of the problem at all. 
    Tibor's site

  • SAP query error - 1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.  'Received Alerts' (OAIB)

    SAP query error - 1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.  'Received Alerts' (OAIB)
    SELECT    
    CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
    WHEN T0.DocStatus = 'C' THEN 'CLOSED'  END  AS 'Document Status',
    T0.DocDate AS 'Posting Date',
    T0.DocNum AS 'Doc.No',
    T0.NumAtCard,
    T0.TransId AS 'Trans. No.',
    T0.Comments AS 'Remarks',
    T0.CardCode AS 'Offset Acct',
    T0.CardName AS 'Offset Acct Name',
    sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
    T3.DueDate AS 'Cheque Date',
    T3.CheckSum AS 'Amount'
    FROM         ODPO AS T0 LEFT OUTER JOIN
                          VPM2 AS T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
         OVPM AS T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
                          VPM1 AS T3 ON T2.DocEntry = T3.DocNum
    where T0.DocDate>='[%0]' and T0.DocDate<='[%1]'

    Hi,
    Try this:
    SELECT   
    CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
    WHEN T0.DocStatus = 'C' THEN 'CLOSED'  END  AS 'Document Status',
    T0.DocDate AS 'Posting Date',
    T0.DocNum AS 'Doc.No',
    T0.NumAtCard,
    T0.TransId AS 'Trans. No.',
    T0.Comments AS 'Remarks',
    T0.CardCode AS 'Offset Acct',
    T0.CardName AS 'Offset Acct Name',
    sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
    T3.DueDate AS 'Cheque Date',
    T3.CheckSum AS 'Amount'
    FROM         ODPO  T0 LEFT OUTER JOIN
                          VPM2  T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry
    LEFT OUTER JOIN
         OVPM  T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
                          VPM1  T3 ON T2.DocEntry = T3.DocNum
    where T0.DocDate >= '[%0]' and T0.DocDate <='[%1]'
    group by T0.DocStatus,T0.DocDate ,
    T0.DocNum ,
    T0.NumAtCard,
    T0.TransId ,
    T0.Comments ,
    T0.CardCode,
    T0.CardName ,
    T0.WTSum ,
    T3.DueDate ,
    T3.CheckSum
    Thanks & Regards,
    Nagarajan

  • [Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid object name 'UNKNOW ERROR'. (CINF)

    I am getting following error in each module of SAP B1 9.0 and hence unable to use SAP b'coz I can't add or change any document b'coz of this error.
    Error : [Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid object name 'UNKNOW ERROR'. (CINF)
    please help me to resolve this issue.

    I am getting following error in each module of SAP B1 9.0 and hence unable to use SAP b'coz I can't add or change any document b'coz of this error.
    Error : [Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid object name 'UNKNOW ERROR'. (CINF)
    please help me to resolve this issue.

  • Error Message while adding material in BOM

    Dear All,
    A raw material (A) is in the BOM as on date. A new material (B) which is a new development is to be used henceforth. I have inventory of A which can be consumed for the next 4 to 5 months.The material B is added as an alternate to A in the BOM,with 100 percent probability to B and zero percent to A. This is done to facilitate 2 motives.
    1.To have auto generated PR for material B from the system, when the MRP run is done during the month.
    2.To issue the material A to production based on Production order, which is based on BOM.
    Also I Block the material A for further procurement by setting a special status to the material in the material master.This is done to ensure that no further PR & P.O is generated for material A.
    After a month's time I am creating a BOM, for a new variant, where this material A or B is to be used. As per my earlier logic, I try to put both the materials as alternative to each other,with the 2 motives as mentioned above.
    I am stopped by the system for including material A in the BOM,by an error message since it is blocked for procurement.
    A warning message is welcome but not this error message.
    Can anyone tell me how this can be done.And whether the procedure adopted in this scenario is a optimised one? Any other way to handle such a business situation?
    Regards,
    Aditya

    Hi Aditya,
    I think you can use production version .
    You can create a production version with alternate bom1 with mateiral B.
    Another version with alternate bom2 wtih material A.
    Second option you can use discontinuation process with follow up material
    check this link for further help.
    http://help.sap.com/saphelp_47x200/helpdata/en/ea/e9b3f84c7211d189520000e829fbbd/frameset.htm
    If helpful reward points
    Regards
    Ranga

  • Error message while adding KFF to Standard page through Personalization

    Hi,
    I am trying to add Personal Information KFF to one standard page through personalization, followed below steps.
    1) create item through personalization
    2) Item Style = Flex
    3) Appl Short Name = PER
    4) Name = PEA
    5) Type = key
    But I am getting below error message after come back to page
    The data that defines the flexfield on this field may be inconsistent. Inform your system administrator that the function: KeyFlexfieldDefinitionFactory.getStructureNumber could not find the structure definition for the flexfield specified by Application = PER, Code = PEA and Structure number =
    Please suggest Steps to Add KFF to Standard Page through Personalization.
    Thanks in Advance,
    Hanimi.

    Hi
    Did you add the value for View Instance?
    Regards
    Sahir

  • Error Message while adding songs?

    Whenever I try to add new songs to my ipod, I get an error message on the computer and itunes quits. I tried restoring the ipod, rebooting the computer, re-installing itunes, but it still won't work. Need help!

    goto
    www.videora.com and find the iPod Converter...it should be at the bottom of the page.
    Then to copy DVD's you mus find a DVD Decrypter which you can just search on yahoo to find.

  • Already opened error message while opening GP work item

    Hi Experts
    We are on NW 7.0 SP 14. We have a custom developed solution integrated with Guided procedure workflow. This workflow was working fine for almost 5-6 months. For last few days we have started getting following issue when one of the step processor executes the work item in the UWL.
         The following action has been opened by another 1 user(s). The last access time is: Tuesday, July 28, 2009 3:09:26 PM.
    This error is coming when there is only one user assigned as processor of the step and he opens the work item for first time.
    I did a search on this issue in SAP notes and SDN but could not find anything relevant. Let me know if you need more info on this.
    Any pointer to resolve this solution will be appreciated.
    Best Regards
    Prabhakar

    I think the work item may got locked.
    If this the case, you can un-lock it from :
    Guided Procedures --> Administration --> Unlock Objects.
    This may solve your problem.
    Regards,
    Yogesh...

  • Getting error " Conversion failed when converting date and/or time from character string."

    Hello Experts,
    I am getting the above error, when i try to execute the query. 
    DECLARE @START AS DATETIME
    DECLARE @END AS DATETIME
    SET @START = CONVERT(VARCHAR(10), GETDATE()-1,101) + '00:00:00'
    SET @END = CONVERT(VARCHAR(10), GETDATE()-1,101) + '23:59:59'
    Any suggestions as to how to get out of this error.
    Appreciate any help/suggestions.
    Thanks!
    Rahman

    Thanks Latheesh,
    I am able to execute the above query, but when i implement the same in my query, i am getting another error.
    Invalid column name 'DATETIME'.
    Invalid column name 'DATETIME'.
    Invalid column name 'DATETIME'.
    Invalid column name 'DATETIME'.
    DECLARE @START AS DATETIME
    DECLARE @END AS DATETIME
    SET @START = CONVERT(VARCHAR(10), GETDATE()-1,101) + ' 00:00:00'
    SET @END = CONVERT(VARCHAR(10), GETDATE()-1,101) + ' 23:59:59'
    SELECT
    SUBSTRING(A1.TGT,2,4) SATC,
    SUBSTRING(DGT,2,4) COFS,
    (CASE WHEN SG.S_G_E_NM LIKE '%S%' THEN 'SALES' WHEN SG.S_G_E_NM LIKE '%U%' THEN 'SUPPORT' WHEN SG.S_G_E_NM LIKE '%S%' THEN 'CUSTSERV' ELSE 'UNKNOWN' END) SKILL,
    COUNT(*) TOTAL,
    AVG(T1.NET) AS A,
    AVG(T1.TALK + T1.HOLD + T1.WORK) AVGHTIME
    FROM
    SELECT * FROM TABLE WHERE (1=1)
    AND DATETIME >= @START
    AND DATETIME <=@END
    AND PERIPH_ID IN (1111,2222,3333)
    AND TGT_ID NOT IN (12457)
    ANDSEQ_NBR IN (2)
    AND DGT LIKE '8%2400'
    AND TALK > 0
    ) AS T1
    Any guesses as to what could be going wrong here?
    Rahman

Maybe you are looking for

  • Sync strangeness after disk replacement and  OS reinstall

    This was posted in someone elses thread but I didn't want to hijack his thread so I started my own. I'm having a similar issue after a hard drive upgrade and OS reinstall. I added a 500G disk to my older g5 imac, which I sync my iphone to and ever si

  • How can I delete an old exchange email account

    I have a new iPad Air. I restored it from a backup of my old iPad 3. My work exchange email account came with it but does not work. When I followed the procedures my work support provided I found a new email account was created with the same name.  I

  • I got an iCloud helper message on my iPhone and now I can't use the internet

    Hi all, I received a message on my computer from iCloud helper? Saying I had a virus and it lists everything that is at risk, and then says to call a number. I'm maybe not the most brilliant, and I called. I allowed remote access to my computer and s

  • Freeze during download

    I recently tried downloading from itunes store and it froze in the middle. I got charged for the download but it did not transfer into my purchased file. What can I do?

  • Solaris 9/8 Compatibility

    I would like to know if there is any documentation that speaks to the compatibility of applications developed under Solaris 9 and run on Solaris 8.