Must declare the scalar variable error

I am getting the error "Must declare the scalar variable "@Result""  when i execute the below query
declare @sql nvarchar(max),
@tablename varchar(200),
@Id int,
@Result int
set @tablename='xyz'
set @id=1
SET @sql = '
SELECT @Result=COUNT( Id ) FROM  ' + @TableName+ ' WHERE RunRegisterKey=' +convert(nvarchar(100),@ID)  
EXEC sys.sp_executesql @sql

In addition to Visakh's solution: the reason you got the error message is because the piece of dynamic SQL is not part of the stored procedure, but constiutes a scope of its own. Thus variables declared in the surrounding procedure are not visible.
Also, you should the dynamic SQL this way:
SET @sql = N'
SELECT @Result=COUNT( Id ) FROM  ' + quotename(@TableName) +
' WHERE RunRegisterKey=@ID'
SET @Params = N'@Result int OUTPUT, @ID int'
EXEC sys.sp_executesql @sql,@Params,@Result = @Result OUT, @ID = @ID
That is, use quotename for the table name, in case you have a table named
sys.objects; SHUTDOWN WITH NOWAIT; --
Furthermore, pass @ID as a parameter rather than concatenating it to the string. It is both easier and safer.
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • Getting "Must declare the scalar variable" Error

    Hello All,
    I have write following query to block invoice which has Prices not equal to PriceList as below.
    -- To Block Invoices which has Prices not equal to PriceList
    IF (@transaction_type='A' OR @transaction_type = 'U') AND CAST(@OBJECT_TYPE = '18')
    BEGIN
        SELECT T1.ItemCode,
                T1.Price AS PO_Price,
                T2.U_ListPrice AS Listed_Price
            FROM OPCH AS T0 
            INNER JOIN
            PCH1 AS T1 ON
            T0.DocEntry = T1.DocEntry
            LEFT OUTER JOIN    
            [dbo].[@PRICELISTS] AS T2 ON
            T1.ItemCode = T2.U_ItemNo
        WHERE
                    T1.DocEntry = @list_of_cols_val_tab_del) AND
            (T1.Price <> T2.U_ListPrice)   
    BEGIN
    SET @error = 123
    SET @error_message = 'Deviation in price'
    END
    END
    But after Execution got following Errors
    Msg 137, Level 15, State 2, Line 2
    Must declare the scalar variable "@transaction_type".
    Msg 137, Level 15, State 2, Line 19
    Must declare the scalar variable "@list_of_cols_val_tab_del".
    Msg 137, Level 15, State 1, Line 22
    Must declare the scalar variable "@error".
    Msg 137, Level 15, State 1, Line 23
    Must declare the scalar variable "@error_message".
    Please Help
    Regards
    Hitul

    Hi Hitul,
    Please check Snapshot.
    Please see Red Lines for SBO_SP_TransactionNotification Procedure.
    Paste your code below ADD YOUR CODE HERE.
    Hope this help
    Regards::::
    Atul Chakraborty

  • Must declare the Scalar variable *@prompt*.. (IES 10901)".

    Hi,
    I am getting an error: "Database error Must declare the Scalar variable *@prompt*.. (IES 10901)".
    backend: SQLServer
    The dim, Lovs are valid in IDT universe.
    There is a Fiscal Year Month Dim in Universe=SELECT
      cast(convert(varchar(6),DATEADD (YEAR,"COST_SUMMARY_FACT_VR"."FISC_YEAR"-1900,DATEADD(MONTH,"COST_SUMMARY_FACT_VR"."FISC_PERIOD"-1,DATEADD(DAY,0,0 ))),112) as int)
    FROM "COST_SUMMARY_FACT_VR"
    Lov
    There are two LOVs FP_From, FP_To
    1) FP_From= select distinct cast(convert(varchar(6),DATEADD (YEAR,"COST_SUMMARY_FACT_VR"."FISC_YEAR"-1900,DATEADD(MONTH,"COST_SUMMARY_FACT_VR"."FISC_PERIOD"-1,DATEADD(DAY,0,0 ))),112) as int) from COST_SUMMARY_FACT_VR order by 1
    2) FP_To=select distinct cast(convert(varchar(6),DATEADD (YEAR,"COST_SUMMARY_FACT_VR"."FISC_YEAR"-1900,DATEADD(MONTH,"COST_SUMMARY_FACT_VR"."FISC_PERIOD"-1,DATEADD(DAY,0,0 ))),112) as int) from COST_SUMMARY_FACT_VR order by 1
    Prompts
    There are two universe prompts
    1) FP_From is Numeric and LOV FP_From is attached
    2) FP_To is Numeric and LOV FP_To is attached
    Using the universe prompts in webi as
    Fiscal Year Month between FP_From and FP_To
    Qry is executing perfectly in backend.

    In addition to Visakh's solution: the reason you got the error message is because the piece of dynamic SQL is not part of the stored procedure, but constiutes a scope of its own. Thus variables declared in the surrounding procedure are not visible.
    Also, you should the dynamic SQL this way:
    SET @sql = N'
    SELECT @Result=COUNT( Id ) FROM  ' + quotename(@TableName) +
    ' WHERE RunRegisterKey=@ID'
    SET @Params = N'@Result int OUTPUT, @ID int'
    EXEC sys.sp_executesql @sql,@Params,@Result = @Result OUT, @ID = @ID
    That is, use quotename for the table name, in case you have a table named
    sys.objects; SHUTDOWN WITH NOWAIT; --
    Furthermore, pass @ID as a parameter rather than concatenating it to the string. It is both easier and safer.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Must declare the scalar variable

    I Am getting error as Must declare the scalar variable "@Imageid" for the following code,while executing,
    exec spGetPager  ' ' , ' ', ' 3 ', ' '
    In my coding I pass querystring value like 1,2,3 etc
    CREATE PROCEDURE spGetPager
          @PageNo int = 1,  
          @ItemsPerPage int = 1,  
     @Imageid int,
          @TotalRows int out  
    AS  
    BEGIN  
      SET NOCOUNT ON  
      DECLARE  
        @StartIdx int,  
        @SQL nvarchar(max),   
        @SQL_Conditions nvarchar(max),   
        @EndIdx int
          IF @PageNo < 1 SET @PageNo = 1  
          IF @ItemsPerPage < 1 SET @ItemsPerPage = 10  
          SET @StartIdx = (@PageNo -1) * @ItemsPerPage + 1  
          SET @EndIdx = (@StartIdx + @ItemsPerPage) - 1  
          SET @SQL = 'SELECT Imageid,Imagepath,imagename,username  
                    FROM (  
                    SELECT  ROW_NUMBER() OVER(ORDER BY Imageid) AS Row, *  
                          FROM  Imageupload ) AS tbl WHERE Imageid=@Imageid AND Row >= '  
                                        + CONVERT(varchar(9), @StartIdx) + ' AND  
                           Row <=  ' + CONVERT(varchar(9), @EndIdx)  
          EXEC sp_executesql @SQL  
          SET @SQL = 'SELECT @TotalRows=COUNT(*) FROM Imageupload'  
          EXEC sp_executesql  
            @query = @SQL,  
            @params = N'@TotalRows INT OUTPUT',  
            @TotalRows = @TotalRows OUTPUT  
    END
    Thanks in Advance

    you cant use variable directly in concatenation operator as its of type int. you need to cast it first as below
    CREATE PROCEDURE spGetPager
    @PageNo int = 1,
    @ItemsPerPage int = 1,
    @Imageid int,
    @TotalRows int out
    AS
    BEGIN
    SET NOCOUNT ON
    DECLARE
    @StartIdx int,
    @SQL nvarchar(max),
    @SQL_Conditions nvarchar(max),
    @EndIdx int
    IF @PageNo < 1 SET @PageNo = 1
    IF @ItemsPerPage < 1 SET @ItemsPerPage = 10
    SET @StartIdx = (@PageNo -1) * @ItemsPerPage + 1
    SET @EndIdx = (@StartIdx + @ItemsPerPage) - 1
    SET @SQL = 'SELECT Imageid,Imagepath,imagename,username
    FROM (
    SELECT ROW_NUMBER() OVER(ORDER BY Imageid) AS Row, *
    FROM Imageupload ) AS tbl WHERE Imageid=' + CAST(@Imageid AS varchar(50)) + ' AND Row >= '
    + CONVERT(varchar(9), @StartIdx) + ' AND
    Row <= ' + CONVERT(varchar(9), @EndIdx)
    EXEC sp_executesql @SQL
    SET @SQL = 'SELECT @TotalRows=COUNT(*) FROM Imageupload'
    EXEC sp_executesql
    @query = @SQL,
    @params = N'@TotalRows INT OUTPUT',
    @TotalRows = @TotalRows OUTPUT
    END
    That being I didnt understand why you need dynamic sql here. There's no dynamicity involved as i see
     you could simply use a sql like below
    CREATE PROCEDURE spGetPager
    @PageNo int = 1,
    @ItemsPerPage int = 1,
    @Imageid int,
    @TotalRows int out
    AS
    BEGIN
    SET NOCOUNT ON
    DECLARE
    @StartIdx int,
    @EndIdx int
    IF @PageNo < 1 SET @PageNo = 1
    IF @ItemsPerPage < 1 SET @ItemsPerPage = 10
    SET @StartIdx = (@PageNo -1) * @ItemsPerPage + 1
    SET @EndIdx = (@StartIdx + @ItemsPerPage) - 1
    SELECT Imageid,Imagepath,imagename,username
    FROM (
    SELECT ROW_NUMBER() OVER(ORDER BY Imageid) AS Row, *
    FROM Imageupload ) AS tbl WHERE Imageid=@Imageid
    AND Row >= @StartIdx
    AND Row <= @EndIdx
    SELECT @TotalRows=COUNT(*) FROM Imageupload
    END
    to achieve same requirement.
    Make sure you read
    http://www.sommarskog.se/dynamic_sql.html
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Error must declare the scalar variable

    por que me marca ese error una consulta?
    DECLARE  @feci AS datetime
    DECLARE @fecf AS datetime
    SET @FECI=(SELECT DISTINCT(T0.DOCDATE) FROM ORTT T0 WHERE T0.DOCDATE='[%0]')
    SET @FECF=(SELECT DISTINCT(T0.DOCDATE) FROM ORTT T0 WHERE T0.DOCDATE='[%1]')
    EXEC DBO.COMPARATIVO @FECI,@FECF
    Edited by: mary merecias on Nov 17, 2011 3:15 PM

    el codigo no, son las variables. si pongo este código me marca que no tiene un select MUST SPECIFY TABLE TO SELECT FROM
    Declare @fec1 as datetime
    Declare @fec2 as datetime
    SET @fec1=[%0]
    SET @fec2=[%1]
    SELECT DISTINCT(T0.itemcode),T0.itemname,T0.onhand,     
          (SELECT SUM(PCH1.linetotal) AS TOTAL
               FROM OPCH
                  INNER JOIN pch1 on OPCH.docentry=PCH1.docentry
                INNER JOIN OITM ON OITM.ITEMCODE=PCH1.ITEMCODE
               WHERE pch1.targettype<>'19' and OITM.itemcode=T0.ITEMCODE AND OPCH.DOCDATE>=@FEC1 AND OPCH.DOCDATE<=@fec2)AS 'TOTAL COMPRAS',
         (SELECT SUM(PCH1.QUANTITY) AS TOTAL
               FROM OPCH
                  INNER JOIN pch1 on OPCH.docentry=PCH1.docentry
                INNER JOIN OITM ON OITM.ITEMCODE=PCH1.ITEMCODE
               WHERE pch1.targettype<>'19' and OITM.itemcode=T0.ITEMCODE AND OPCH.DOCDATE>=@fec1 AND OPCH.DOCDATE<=@fec2 ) AS 'PIEZAS COMPRADAS',
          (SELECT SUM(INV1.linetotal) AS TOTAL
               FROM OINV
                  INNER JOIN INV1 on OINV.docentry=INV1.docentry
                INNER JOIN OITM ON OITM.ITEMCODE=INV1.ITEMCODE
               WHERE INV1.targettype<>'14' and OITM.itemcode=T0.ITEMCODE AND OINV.DOCDATE>=@fec1 AND OINV.DOCDATE<=@fec2)AS 'TOTAL VENTAS',
         (SELECT SUM(INV1.QUANTITY) AS TOTAL
               FROM OINV
                  INNER JOIN INV1 on OINV.docentry=INV1.docentry
                INNER JOIN OITM ON OITM.ITEMCODE=INV1.ITEMCODE
               WHERE INV1.targettype<>'14' and OITM.itemcode=T0.ITEMCODE AND OINV.DOCDATE>=@fec1 AND OINV.DOCDATE<=@fec2 ) AS 'PIEZAS VENDIDAS'
         FROM OITM T0
    GROUP BY T0.itemcode,T0.itemname,T0.onhand
    en SQL SERVER si funciona bien
    Edited by: mary merecias on Nov 17, 2011 4:50 PM
    Edited by: mary merecias on Nov 17, 2011 4:51 PM
    Edited by: mary merecias on Nov 17, 2011 4:53 PM

  • Msg 137, Level 15, State 2, Line 29 Must declare the scalar variable "@ACTIVE_STATUS".

    USE [NC_DB]
    GO
    /****** Object:  StoredProcedure [dbo].[S_EDIT_USER]    Script Date: 12/23/2013 12:32:44 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[S_EDIT_USER]  
    (  @DSA_CODE VARCHAR(10)  
        ,@REQUESTOR_DEPT VARCHAR(40) 
        ,@ACTIVE_STATUS INT  
        ,@MAKER_ID VARCHAR(10)  
        ,@MAKER_IP VARCHAR(20)  
        ,@ERROR_CODE INT OUTPUT  
    AS  
    BEGIN  
    DECLARE @CNT INT;   
    DECLARE @SQL NVARCHAR(MAX);
    --DECLARE @REQUESTOR_DEPT VARCHAR(40);
    --print(@REQUESTOR_DEPT);
    SELECT @CNT = COUNT(*) FROM TMAS_UAM_USER_TMP WHERE DSA_CODE = @DSA_CODE;  
    IF @CNT > 0  
     SET @ERROR_CODE = 1;  
    ELSE  
     SET @ERROR_CODE = 0; 
    if @REQUESTOR_DEPT = 'N'
     SET @REQUESTOR_DEPT = ''; 
    ELSE  
     SET @REQUESTOR_DEPT = @REQUESTOR_DEPT ; 
     print @REQUESTOR_DEPT;
    IF @ERROR_CODE = 0
    set @SQL = 'INSERT INTO TMAS_UAM_USER_TMP (  
       DSA_CODE  
               ,DSA_NAME  
               ,DSA_CITY  
               ,DSA_PRODUCT  
               ,DSA_PHNO  
               ,DSA_MOBNO  
               ,DSA_RQSTR  
               ,DSA_RQSTR_DEPT  
               ,GROUP_ID  
               ,ACTIVE_STATUS  
               ,REQ_TYPE  
               ,LAST_LOGED_IN  
               ,CREATED_ID  
         ,CREATED_IP  
         ,CREATED_DATE  
               ,MAKER_ID  
               ,MAKER_IP  
               ,MAKER_DATE  
     ) SELECT DSA_COD  
         ,DSA_NAM  
         ,DSA_CTY  
         ,PRODUCT  
         ,DSA_PHO  
         ,DSA_MOB  
         ,REQUESTOR  
         ,'+@REQUESTOR_DEPT+'
         ,GROUP_ID  
         ,@ACTIVE_STATUS 
         ,1  
         ,LAST_LOG_DAT  
         ,CREATED_ID  
         ,CREATED_IP  
         ,CREATED_DATE  
         ,'+@MAKER_ID+'  
         ,'+@MAKER_IP+'  
         ,GETDATE()  
        FROM DSA_MST WHERE DSA_COD = '+@DSA_CODE+' and ';
    if @REQUESTOR_DEPT = 'N'
    begin
    set @SQL = @SQL + 'REQUESTOR_DEPT is null';
    print('If Query'+@SQL);
    end
    else
    begin
        set @SQL = @SQL + 'REQUESTOR_DEPT = ''' + @REQUESTOR_DEPT + '''';
        print('Else Query'+@SQL);
        end
       --EXEC sp_executesql @SQL, N'@REQUESTOR_DEPT varchar(100) output', @REQUESTOR_DEPT output
    --EXECUTE sp_executesql @SQL;
    execute (@SQL);
    RETURN @ERROR_CODE;  
    END  

    The problem is that you are using dynamic SQL which you should not. Use the
    below instead. Uncomment the query hint if you are worried about
    performance.
    ALTER PROCEDURE [dbo].[S_EDIT_USER]  
    (  @DSA_CODE VARCHAR(10)  
        ,@REQUESTOR_DEPT VARCHAR(40) 
        ,@ACTIVE_STATUS INT  
        ,@MAKER_ID VARCHAR(10)  
        ,@MAKER_IP VARCHAR(20)  
        ,@ERROR_CODE INT OUTPUT  
    AS  
    BEGIN  
    DECLARE @CNT INT;   
    --DECLARE @REQUESTOR_DEPT VARCHAR(40);
    --print(@REQUESTOR_DEPT);
    SELECT @CNT = COUNT(*) FROM TMAS_UAM_USER_TMP WHERE DSA_CODE = @DSA_CODE;  
    IF @CNT > 0  
     SET @ERROR_CODE = 1;  
    ELSE  
     SET @ERROR_CODE = 0; 
    if @REQUESTOR_DEPT = 'N'
     SET @REQUESTOR_DEPT = ''; 
    ELSE  
     SET @REQUESTOR_DEPT = @REQUESTOR_DEPT ; 
     print @REQUESTOR_DEPT;
    IF @ERROR_CODE = 0
    INSERT INTO TMAS_UAM_USER_TMP (  
       DSA_CODE  
               ,DSA_NAME  
               ,DSA_CITY  
               ,DSA_PRODUCT  
               ,DSA_PHNO  
               ,DSA_MOBNO  
               ,DSA_RQSTR  
               ,DSA_RQSTR_DEPT  
               ,GROUP_ID  
               ,ACTIVE_STATUS  
               ,REQ_TYPE  
               ,LAST_LOGED_IN  
               ,CREATED_ID  
         ,CREATED_IP  
         ,CREATED_DATE  
               ,MAKER_ID  
               ,MAKER_IP  
               ,MAKER_DATE  
     ) SELECT DSA_COD  
         ,DSA_NAM  
         ,DSA_CTY  
         ,PRODUCT  
         ,DSA_PHO  
         ,DSA_MOB  
         ,REQUESTOR  
         ,'+@REQUESTOR_DEPT+'
         ,GROUP_ID  
         ,@ACTIVE_STATUS 
         ,1  
         ,LAST_LOG_DAT  
         ,CREATED_ID  
         ,CREATED_IP  
         ,CREATED_DATE  
         ,'+@MAKER_ID+'  
         ,'+@MAKER_IP+'  
         ,GETDATE()  
        FROM DSA_MST
    WHERE DSA_COD = @DSA_CODE
     and  (REQUESTOR_DEPT = @REQUESTOR_DEPT OR @REQUESTOR_DEPT = 'N')
    -- OPTION (RECOMPILE)
    END  
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Query in SQL 2008R2 error Msg 1087, Level 15, State 2, Line 31 Must declare the table variable

    Hello Experts, 
    Can You help me; I get the follwing error in my query
    Msg 1087, Level 15, State 2, Line 31
    Must declare the table variable "@ASE_SUBART_GROEP".
    the @ASE_SUBART_GROEP is a self-defined table in this SQL environment.
    Maybe you know the error or the missing part
    Thanks in advance, Jos Dielemans

    I'm not familiar with SAP Business One unfortunately, so can only be of limited help here. But I'm going to guess that @ASE_SUBART_GROEP is a table variable passed to a stored procedure and is defined and passed down by the application, so you won't
    be able to copy-paste this code directly into management studio and get it to work.
    You could remove the join to return *all* records. Although the dataset might be very big
    SELECT T0.CardCode AS 'Klantnr'
    ,T0.CardName AS 'Klantnaam'
    ,T4.GroupName AS 'Klantgroep'
    ,T9.Descr AS 'Merknaam'
    ,T5.SlpName AS 'Verkoper'
    ,T3.MailCity AS 'Leverplaats'
    ,T7.NAME AS 'Leverland'
    ,T3.City AS 'Factuurplaats'
    ,T7.NAME AS 'Factuurland'
    ,T0.DocNum AS 'Documentnr'
    ,T0.DocDate AS 'Datum'
    ,Cast((Datepart(Year, T0.DocDate)) AS VARCHAR) AS 'Jaar'
    ,RIGHT('00' + CAST(DATEPART(MONTH, T0.DocDate) AS VARCHAR(2)), 2) AS 'Maand'
    ,(Cast((Datepart(Year, T0.DocDate)) AS VARCHAR) + '-' + RIGHT('00' + CAST(DATEPART(MONTH, T0.DocDate) AS VARCHAR(2)), 2)) AS 'Periode'
    ,T1.ItemCode AS 'Artikelnr'
    ,T2.ItemName AS 'Artikelnaam'
    ,T1.Quantity AS 'Aantal VEH'
    ,T2.SVolume AS 'Aantal EH per VEH'
    ,(T1.Quantity * T2.SVolume) AS 'Aantal EH'
    ,T8.UnitName AS 'EH-Naam'
    ,T6.ItmsGrpNam AS 'Artikelgroep'
    ,T2.U_ItemGrp AS 'Hoofdgroep'
    ,T10.NAME AS 'Subgroep'
    ,T1.CogsAcct AS 'Kostpr.rek.'
    ,T1.AcctCode AS 'Opbrengstrek.'
    ,T1.LineTotal AS 'BrutoOmzet'
    ,T0.DiscPrcnt AS 'Korting'
    ,(+ T1.LineTotal * (100 - T0.DiscPrcnt) / 100) AS 'NettoOmzet'
    FROM dbo.OINV T0
    INNER JOIN dbo.INV1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
    INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode
    INNER JOIN OCRG T4 ON T3.GroupCode = T4.Groupcode
    INNER JOIN OSLP T5 ON T3.SlpCode = T5.SlpCode
    INNER JOIN OITB T6 ON T2.ItmsGrpCod = T6.ItmsGrpCod
    INNER JOIN OCRY T7 ON T3.Country = T7.Code
    LEFT OUTER JOIN OLGT T8 ON T2.SVolUnit = T8.UnitCode
    LEFT OUTER JOIN UFD1 T9 ON T3.U_ZPgroep = T9.FldValue
    AND TableID = 'OCRD'
    AND FieldID = 2
    --LEFT OUTER JOIN @ASE_SUBART_GROEP T10 ON T2.U_ASE_SUB_ARTGROEP = T10.Code
    WHERE T0.DocDate >= '20120101'
    AND T0.Canceled = 'N'
    UNION ALL
    SELECT T0.CardCode AS 'Klantnr'
    ,T0.CardName AS 'Klantnaam'
    ,T4.GroupName AS 'Klantgroep'
    ,T9.Descr AS 'Merknaam'
    ,T5.SlpName AS 'Verkoper'
    ,T3.MailCity AS 'Leverplaats'
    ,T7.NAME AS 'Leverland'
    ,T3.City AS 'Factuurplaats'
    ,T7.NAME AS 'Factuurland'
    ,T0.DocNum AS 'Documentnr'
    ,T0.DocDate AS 'Datum'
    ,Cast((Datepart(Year, T0.DocDate)) AS VARCHAR) AS 'Jaar'
    ,RIGHT('00' + CAST(DATEPART(MONTH, T0.DocDate) AS VARCHAR(2)), 2) AS 'Maand'
    ,(Cast((Datepart(Year, T0.DocDate)) AS VARCHAR) + '-' + RIGHT('00' + CAST(DATEPART(MONTH, T0.DocDate) AS VARCHAR(2)), 2)) AS 'Periode'
    ,T1.ItemCode AS 'Artikelnr'
    ,T2.ItemName AS 'Artikelnaam'
    ,- T1.Quantity AS 'Aantal VEH'
    ,T2.SVolume AS 'Aantal EH per VEH'
    ,(- T1.Quantity * T2.SVolume) AS 'aantal EH'
    ,T8.UnitName AS 'EH-Naam'
    ,T6.ItmsGrpNam AS 'Artikelgroep'
    ,T2.U_ItemGrp AS 'Hoofdgroep'
    ,T10.NAME AS 'Subgroep'
    ,T1.CogsAcct AS 'Kostpr.rek.'
    ,T1.AcctCode AS 'Opbrengstrek.'
    ,- T1.LineTotal AS 'BrutoOmzet'
    ,T0.DiscPrcnt AS 'Korting'
    ,(+ T1.LineTotal * (100 - T0.DiscPrcnt) / 100) AS 'NettoOmzet'
    FROM dbo.ORIN T0
    INNER JOIN dbo.RIN1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
    INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode
    INNER JOIN OCRG T4 ON T3.GroupCode = T4.Groupcode
    INNER JOIN OSLP T5 ON T3.SlpCode = T5.SlpCode
    INNER JOIN OITB T6 ON T2.ItmsGrpCod = T6.ItmsGrpCod
    INNER JOIN OCRY T7 ON T3.Country = T7.Code
    LEFT OUTER JOIN OLGT T8 ON T2.SVolUnit = T8.UnitCode
    LEFT OUTER JOIN UFD1 T9 ON T3.U_ZPgroep = T9.FldValue
    AND TableID = 'OCRD'
    AND FieldID = 2
    --LEFT OUTER JOIN @ASE_SUBART_GROEP T10 ON T2.U_ASE_SUB_ARTGROEP = T10.Code
    WHERE T0.DocDate >= '20120101'
    AND T0.Canceled = 'N'
    ORDER BY T0.CardCode
    The join to the table variable has been commented out above, so the code should run. After that you might want to update the WHERE clause to include only particular sub-groups

  • Where is it declared the return variable?

    Hi everyone,
    please which system privileges must you have to recompile a stored procedure owned by another application developer?
    and where is it declared the return variable?
    thank you

    In short you will need ALTER ANY PROCEDURE privilidge for that.
    Lets do a test for this:
    From User A:
    SQL> create table test as select * from user_objects where rownum<10;
    SQL> create procedure test_proc as
    2 begin
    3 delete test;
    4 commit;
    5 end;
    6 /
    Procedure created.
    Now from User Scott:
    alter procedure cr.test_proc compile
    ERROR at line 1:
    ORA-01031: insufficient privileges
    Now connect to user A and do the following:
    1* grant alter any procedure to scott
    SQL> /
    Grant succeeded.
    Now from Scott user:
    alter procedure cr.test_proc compile;
    Procedure altered.
    SQL> show errors
    No errors.
    Thats what you wanted.
    Riaz

  • In Dreamweaver MySites[New Site] menu option , if I had a hosting JSP/PHP what I must declare the hosting JSP or PHP ?

    In Dreamweaver MySites[New Site] menu option , if I had a hosting JSP/PHP what I must declare the hosting JSP or PHP ?

    The simplest answer is to choose the language you work best with, and that fits the clients specification the best.
    I have mixed server languages on a site before, (would not recommend) when a client has decided they wish to change from their old one to a new(er) /different one, the only thing you must watch if doing this, is that you do not mix languages on the same page (will not work correctly, if at all), and parameter passing.
    PZ

  • How do I declare the extra variable?

    List the customer number, name, (first and last), order number, order date, employee number, employee, name (first and last), product number, product name, and order cost, (orderline.qty*prodprice) for products ordered on January 23, 2009
    I have no column called order cost in any tables. How do I declare a new variable called order cost in the query? And to date line is missing a right parenthesis. The exact line worked with a different question but accept that I have added on the date in this line.
    SELECT C.CUSTNO, C.CUSTFIRSTNAME, C.CUSTLASTNAME, O.ORNO, O.ORDDATE, E.EMPNO, E.EMPFIRSTNAME, E.EMPLASTNAME, P.PRODNO, P.PRODNAME, L.PRODNO, L.QTY, Order_cost
    From Customer c, Orders o, ORDERLINE L, Employee e, Product P
    where(C.CUSTNO=O.CUSTNO) and(O.EMPNO = E.EMPNO) and (O.ORDNO = L.ORDNO) and (P.PRODNO = L.PRODNO) and Order_cost= (L.QTY*ProdPrice)
    and (o.OrdDate >= to_date('23/01/2009', 'dd/'mm/yyyy') and o.OrdDate <= add_months(to_date('23/01/2009','dd/'mm/yyyy'),+1)-1);
    Thanks.

    Hi,
    user9164240 wrote:
    List the customer number, name, (first and last), order number, order date, employee number, employee, name (first and last), product number, product name, and order cost, (orderline.qty*prodprice) for products ordered on January 23, 2009
    I have no column called order cost in any tables. How do I declare a new variable called order cost in the query? And to date line is missing a right parenthesis. The exact line worked with a different question but accept that I have added on the date in this line.
    SELECT C.CUSTNO, C.CUSTFIRSTNAME, C.CUSTLASTNAME, O.ORNO, O.ORDDATE, E.EMPNO, E.EMPFIRSTNAME, E.EMPLASTNAME, P.PRODNO, P.PRODNAME, L.PRODNO, L.QTY, Order_cost
    From Customer c, Orders o, ORDERLINE L, Employee e, Product P
    where(C.CUSTNO=O.CUSTNO) and(O.EMPNO = E.EMPNO) and (O.ORDNO = L.ORDNO) and (P.PRODNO = L.PRODNO) and Order_cost= (L.QTY*ProdPrice)
    and (o.OrdDate >= to_date('23/01/2009', 'dd/'mm/yyyy') and o.OrdDate <= add_months(to_date('23/01/2009','dd/'mm/yyyy'),+1)-1);Never write, let alone post, unformatted code.
    Format your code so that it's easy to see (among other things) that
    (1) the arguments to TO_DATE match each other, and
    (2) parentheses are balanced.
    For example:
    SELECT      C.CUSTNO
    ,      C.CUSTFIRSTNAME
    ,      C.CUSTLASTNAME
    ,      O.ORNO
    ,      O.ORDDATE
    ,      E.EMPNO
    ,     E.EMPFIRSTNAME
    ,     E.EMPLASTNAME
    ,     P.PRODNO
    ,     P.PRODNAME
    ,     L.PRODNO
    ,     L.QTY
    ,     L.QTY * ProdPrice     AS Order_cost
    From      Customer     c
    ,     Orders           o
    ,     ORDERLINE     L
    ,     Employee     e
    ,     Product          P
    where     (C.CUSTNO     = O.CUSTNO)
    and     (O.EMPNO      = E.EMPNO)
    and      (O.ORDNO      = L.ORDNO)
    and      (P.PRODNO      = L.PRODNO)
    and      (o.OrdDate      >= to_date ( '23/01/2009'
                           , 'dd/'mm/yyyy'          -- WRONG!  Look at alignment
    and      o.OrdDate      <= add_months ( to_date ( '23/01/2009'
                                  , 'dd/'mm/yyyy'     -- WRONG!  Look at alignment
                              , +1
                              ) -1
    )                    -- Extra right parentheses
    ;When you post formatted text on this site, type these 6 characters
    \(all small letters, inside curly brackets) before and after each section of formatted text.  If you don't, this site will not show all the extra spaces.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Stored Proc with SSRS multi value parameter gives " Must Declare scalar Varaiable @StateID

    Hi All,
    I have one stored proc with @fromDate , @Todate and multivalue input
    parameter@StateID of type integer.
    When I run below stored proc via SSRS by selecting multiple values thru multiValue parameter into @StateID...it gives error saying "Must Declare scalar variable @StateID"
    Not sure what is wrong with the input parameters.
    ID is Integer type in all the 3 tables - dbo.EastCities, dbo.WestCities  , dbo.Country
    I need help fixing this  "Must Declare scalar variable @StateID" error
    This is the UDF split() I am using..
    Function:
    CREATE FUNCTION dbo.SplitStateID
    (    @List VARCHAR(MAX))
    RETURNS TABLE
    AS   
    RETURN   
    (        SELECT DISTINCT [Value] = CONVERT(INT, LTRIM(RTRIM(CONVERT( VARCHAR(12),SUBSTRING(@List, Number, CHARINDEX(',', @List + ',', Number) - Number))))
     FROM  dbo.Numbers       
     WHERE Number <= CONVERT(INT, LEN(@List))AND SUBSTRING(',' + @List, Number, 1) = ','    );
     GO
     SELECT [Value] FROM dbo.SplitStateID('10,30,50');
    Also, I have created dbo.Numbers table which is used in udf..
    reference url -- > 
    http://sqlblog.com/blogs/aaron_bertrand/archive/2009/08/01/processing-a-list-of-integers-my-approach.aspx
    SET NOCOUNT ON;
    DECLARE @UpperLimit INT;
    SET @UpperLimit = 10000;
    WITH n AS(   
    SELECT        rn = ROW_NUMBER() OVER        (ORDER BY s1.[object_id])   
    FROM sys.objects AS s1   
    CROSS JOIN sys.objects AS s2   
    CROSS JOIN sys.objects AS s3)
    SELECT [Number] = rn - 1
    INTO dbo.Numbers FROM n
    WHERE rn <= @UpperLimit + 1;
    CREATE UNIQUE CLUSTERED INDEX n ON dbo.Numbers([Number]);
    Stored procedure:
    Create Procedure dbo.CountrySelection
    ( @FromDate Date, @ToDate Date, @StateID Int)
    AS
    BEGIN
    set nocount on;
    SELECT * INTO #EastCities
    FROM (
    SELECT ID,Description from dbo.EastCities
    Where ID IN (SELECT Value from dbo.SplitStateID(@StateID))
    ) AS A
    SELECT * INTO #WestCities
    FROM (
    SELECT ID,Description from dbo.WestCities
    Where ID IN (SELECT Value from dbo.SplitStateID(@StateID))
    ) AS B
    SELECT * INTO #Country
    FROM (
    SELECT ID , Description, State,Country From dbo.Country
    ) AS C
    SELECT EC.ID AS East, WC.ID AS West , EC.Description AS EastDesc, WC.Description AS WestDesc, CT.State, CT.Country
    FROM #Country CT
    LEFT JOIN #EastCities EC ON CT.ID=EC.ID
    LEFT JOIN #WestCities WC ON CT.ID=WC.ID
    DROP TABLE #EastCities
    DROP TABLE #WestCities
    DROP TABLE #Country
    END
    Above 3 temp tables are joined by #Country.ID key
    It works fine when single value is passed in @StateID
    Exec dbo.CountrySelection '01/01/2010','02/01/2010',10
    It fails when multi value passed into @StateID
    Exec dbo.CountrySelection '01/01/2010','02/01/2010','10,30,40'
    SSRS error log shows "Must declare scalar variable @StateID"
    Need help in fixing this issue.
    Thanks,
    RH
    sql

    Visakh,
    I changed @StateID date type to varchar(max) and still I get this error.  
    System.Data.SqlClient.SqlException: Must declare the scalar variable "@StateID".
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
    I am running this SO in SSRS quert Type =Text
    Actually sp created on db2 database and due to some limitations I am running(via SSRS) this from different db1 database data source within the same db server. When I run this sp from SSRS query designer(edit query designer button) and pass
    multivalue parameters to @StateID as 10 , 20 it works and gives expected resultset.
    Thanks,
    RH
    sql

  • Declare @p1 variable error when creating multiple search form to show database info

    Hi, all help is incredibly appreciated,
    i have been trying to make a multiple filtered search form for a database in asp / vbscript. I want to be able to select from THIS database table, all info on the rows which id is BETWEEN x and x AND date is BETWEEN x and x AND securitynumber is BETWEEN x and x
    what would be the best way to do this?
    this is what ive got so far, which gives me the error:
    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    [Microsoft][ODBC SQL Server Driver][SQL Server]Must declare the variable '@P1'.
    <%
    Dim rsBundleR__p_selectedDB
    rsBundleR__p_selectedDB = request.form("selectedDataBase")
    If (request.form("selectedDataBase") <> "") Then
      rsBundleR__p_selectedDB = request.form("selectedDataBase")
    End If
    %>
    <%
    Dim rsBundleR__p_idFrom
    rsBundleR__p_idFrom = request.form("bundleIdFrom")
    If (request.form("bundleIdFrom")  <> "") Then
      rsBundleR__p_idFrom = request.form("bundleIdFrom")
    End If
    %>
    <%
    Dim rsBundleR__p_idTo
    rsBundleR__p_idTo = request.form("bundleIdTo")
    If (request.form("bundleIdTo") <> "") Then
      rsBundleR__p_idTo = request.form("bundleIdTo")
    End If
    %>
    <%
    Dim rsBundleR__p_dateFrom
    rsBundleR__p_dateFrom = request.form("fromDate")
    If (request.form("fromDate") <> "") Then
      rsBundleR__p_dateFrom = request.form("fromDate")
    End If
    %>
    <%
    Dim rsBundleR__p_dateTo
    rsBundleR__p_dateTo = request.form("toDate")
    If (request.form("toDate") <> "") Then
      rsBundleR__p_dateTo = request.form("toDate")
    End If
    %>
    <%
    Dim rsBundleR__p_ssFrom
    rsBundleR__p_ssFrom = request.form("fromSS")
    If (request.form("fromSS") <> "") Then
      rsBundleR__p_ssFrom = request.form("fromSS")
    End If
    %>
    <%
    Dim rsBundleR__p_ssTo
    rsBundleR__p_ssTo = request.form("toSS")
    If (request.form("toSS") <> "") Then
      rsBundleR__p_ssTo = request.form("toSS")
    End If
    %>
    <%
    Dim rsBundleR
    Dim rsBundleR_cmd
    Dim rsBundleR_numRows
    Set rsBundleR_cmd = Server.CreateObject ("ADODB.Command")
    rsBundleR_cmd.ActiveConnection = MM_PHPSQL_STRING
    rsBundleR_cmd.CommandText = "SELECT * FROM ? WHERE id BETWEEN ? AND ?  AND fecha_solicitado BETWEEN ? AND ?  AND seguro_social BETWEEN ? AND ? ORDER BY id ASC"
    rsBundleR_cmd.Prepared = true
    rsBundleR_cmd.Parameters.Append rsBundleR_cmd.CreateParameter("param1", 200, 1, 255, rsBundleR__p_selectedDB) ' adVarChar
    rsBundleR_cmd.Parameters.Append rsBundleR_cmd.CreateParameter("param2", 5, 1, -1, rsBundleR__p_idFrom) ' adDouble
    rsBundleR_cmd.Parameters.Append rsBundleR_cmd.CreateParameter("param3", 5, 1, -1, rsBundleR__p_idTo) ' adDouble
    rsBundleR_cmd.Parameters.Append rsBundleR_cmd.CreateParameter("param4", 135, 1, -1, rsBundleR__p_dateFrom) ' adDBTimeStamp
    rsBundleR_cmd.Parameters.Append rsBundleR_cmd.CreateParameter("param5", 135, 1, -1, rsBundleR__p_dateTo) ' adDBTimeStamp
    rsBundleR_cmd.Parameters.Append rsBundleR_cmd.CreateParameter("param6", 200, 1, 255, rsBundleR__p_ssFrom) ' adVarChar
    rsBundleR_cmd.Parameters.Append rsBundleR_cmd.CreateParameter("param7", 200, 1, 255, rsBundleR__p_ssTo) ' adVarChar
    Set rsBundleR = rsBundleR_cmd.Execute
    rsBundleR_numRows = 0
    %>
    someone, please help, this is very important!

    allright i think thats what i did here:
      <% While ((Repeat1__numRows <> 0) AND (NOT rsBundleR.EOF)) %>
    <table align="center" border="1">
              <tr>
                <td align="left" width="50%">id</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("id").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">seguro_social</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("seguro_social").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">numero_estudiante</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("numero_estudiante").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">nombre</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("nombre").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">apellido</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("apellido").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">telefono</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("telefono").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">celular</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("celular").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">direccion_postal</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("direccion_postal").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">direccion_postal_2</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("direccion_postal_2").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">email_pupr</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("email_pupr").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">ciudad</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("ciudad").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">estado</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("estado").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">zona_postal</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("zona_postal").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">direccion_fisica</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("direccion_fisica").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">direccion_fisica_2</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("direccion_fisica_2").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">email_personal</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("email_personal").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">ciudad_fisica</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("ciudad_fisica").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">estado_fisica</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("estado_fisica").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">zona_postal_fisica</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("zona_postal_fisica").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">tipo_estudiante</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("tipo_estudiante").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">termino_prestamo</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("termino_prestamo").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">nombre_referencia_1</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("nombre_referencia_1").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">apellido_referencia_1</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("apellido_referencia_1").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">telefono_referencia_1</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("telefono_referencia_1").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">direccion_postal_1_referencia_1</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("direccion_postal_1_referencia_1").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">direccion_postal_2_referencia_1</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("direccion_postal_2_referencia_1").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">ciudad_referencia_1</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("ciudad_referencia_1").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">estado_referencia_1</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("estado_referencia_1").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">zona_postal_referencia_1</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("zona_postal_referencia_1").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">nombre_referencia_2</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("nombre_referencia_2").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">apllido_refencia_2</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("apllido_refencia_2").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">telefono_referencia_2</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("telefono_referencia_2").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">direccion_postal_1_referencia_2</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("direccion_postal_1_referencia_2").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">direccion_postal_2_referencia_2</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("direccion_postal_2_referencia_2").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">ciudad_referencia_2</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("ciudad_referencia_2").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">estado_referencia_2</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("estado_referencia_2").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">zona_postal_referencia_2</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("zona_postal_referencia_2").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">tipo_de_prestamo</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("tipo_de_prestamo").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">cantidad_prestamo</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("cantidad_prestamo").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">subsidiado</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("subsidiado").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">no_subsidiado</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("no_subsidiado").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">autorizo_pupr</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("autorizo_pupr").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">fecha_solicitado</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("fecha_solicitado").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">estatus</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("estatus").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">revisado_por</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("revisado_por").Value)%></td>
              </tr>
              <tr>
                <td align="left" width="50%">nota_personal</td>
                <td align="left" width="50%"><%=(rsBundleR.Fields.Item("nota_personal").Value)%></td>
              </tr>
            </table>
      <br /><br />
        <%
      Repeat1__index=Repeat1__index+1
      Repeat1__numRows=Repeat1__numRows-1
      rsBundleR.MoveNext()
    Wend
    %>
    , no error is given BUT still, no information is showing.
    However, i dont see the "." either :/
    I made it create a table for each record,
    is it the way i called the information?
    or is the query not finding anything?
    ( there is information in the database )

  • Non static variable error

    There may be more errors in here besides the static variable error. I made the methods static for the method call in my constructor Product(name, price). The purpose of this Class is to the the name and price of a product from user input, subtract 5.00 from the price, and return the new price. Please help!!!
    public class Product
    public Product(String name, double price)
    String product;
    price = Product.getPrice(price);
    Double.toString(price);
    //this.product = product;
    product = Product.getName(name) + Product.getPrice(price);
    public static String getName(String name)
    System.out.println("What is their name?: ");
    name = in.nextLine(); // I GET A NONSTATIC VARIABLE ERROR FOR variable "in" HERE.
    return name;
    public static double getPrice(double price)
    this.price = price;
    System.out.println("What is the price?: ");
    price = in.nextDouble();
    return price;
    public double reducePrice()
    price = price - 5.00;
    return price;
    public String getProduct()
    product = new Product(name, price);
    return product;
    Scanner in = new Scanner(System.in);
    public static String name;
    //public double price;
    }

    you not define the class member properly.
    the class member is define before the constructor as
    public class Product {
         static Scanner in = new Scanner(System.in);
         String product;
         double price;
         public static String name;
         public Product(String name, double price) {
              price = Product.getPrice(price);
              Double.toString(price);
              // this.product = product;
              product = Product.getName(name) + Product.getPrice(price);
    }

  • Error saying "must declare body"

    I was debugging a code and I got it to 1 error.
    It was missing a main method, so I did static void Main(); in the beginning of the code.
    The error says "ffbCS.Program.Main() must declare a body because it is not marked abstract, extern, or partial"
    Does the main method always go in the beginning of the code or can it come after some code? Is there other types of main methods? I used static void
    Main(); because this is the only one that I know of.
    Below is my code
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Collections;
    using System.ComponentModel;
    using System.Device;
    using Microsoft.DirectX;
    using Microsoft.DirectX.DirectInput;
    namespace ffbCS
    class Program
    static void Main();
    public sealed class DirectInputWrapper
    #region ForceType
    <summary style="color:#111111;font-family:'Segoe UI', Arial, sans-serif;font-size:14px;line-height:normal;">
    /// This enumeration simply provides a shorthand way to reference
    /// the custom forces we create -- it's not a base part of DirectX,
    /// though, so you can use a completely different method.
    ///</summary>
    public enum ForceType
    VeryBriefJolt,
    BriefJolt,
    LowRumble,
    HardRumble
    #endregion
    //this class lets us send FF commands to up to two game pads,
    //but your own class could support as many as you want
    private static Device device1;
    private static Device device2;
    private static Dictionary<forcetype,> P1Forces;
    private static Dictionary<forcetype,> P2Forces;
    #region Initialize
    ///<summary style="color:#111111;font-family:'Segoe UI', Arial, sans-serif;font-size:14px;line-height:normal;">
    /// Initialize DirectInput
    ///</summary>
    public static void Initialize( System.Windows.Forms.Control Parent )
    if ( device1 != null )
    device1.Dispose();
    device1 = null;
    if ( device2 != null )
    device2.Dispose();
    device2 = null;
    foreach ( DeviceInstance instance in Manager.GetDevices( DeviceClass.GameControl,
    EnumDevicesFlags.AttachedOnly ) )
    if ( device1 == null )
    device1 = new Device( instance.InstanceGuid );
    else if ( device2 == null )
    device2 = new Device( instance.InstanceGuid );
    DisposeForces();
    P1Forces = new Dictionary<forcetype,>();
    P2Forces = new Dictionary<forcetype,>();
    InitializeDevice( Parent, device1 );
    InitializeDevice( Parent, device2 );
    #endregion
    #region InitializeDevice
    private static void InitializeDevice( System.Windows.Forms.Control Parent, Device Dev )
    if ( Dev == null )
    return;
    Dev.SetDataFormat( DeviceDataFormat.Joystick );
    Dev.SetCooperativeLevel( Parent, CooperativeLevelFlags.Background |
    CooperativeLevelFlags.Exclusive );
    Dev.Properties.AxisModeAbsolute = true;
    Dev.Properties.AutoCenter = false;
    Dev.Acquire();
    int[] axis = null;
    // Enumerate any axes
    foreach ( DeviceObjectInstance doi in Dev.Objects )
    if ( ( doi.ObjectId & (int)DeviceObjectTypeFlags.Axis ) != 0 )
    // We found an axis, set the range to a max of 10,000
    Dev.Properties.SetRange( ParameterHow.ById,
    doi.ObjectId, new InputRange( -5000, 5000 ) );
    int[] temp;
    // Get info about first two FF axii on the device
    if ( ( doi.Flags & (int)ObjectInstanceFlags.Actuator ) != 0 )
    if ( axis != null )
    temp = new int[axis.Length + 1];
    axis.CopyTo( temp, 0 );
    axis = temp;
    else
    axis = new int[1];
    // Store the offset of each axis.
    axis[axis.Length - 1] = doi.Offset;
    if ( axis.Length == 2 )
    break;
    Dictionary<forcetype,> forces;
    if ( Dev == device1 )
    forces = P1Forces;
    else
    forces = P2Forces;
    try
    if ( axis != null )
    forces.Add( ForceType.VeryBriefJolt,
    InitializeForce( Dev, EffectType.ConstantForce, axis,
    6000, EffectFlags.ObjectOffsets | EffectFlags.Spherical, 150000 ) );
    forces.Add( ForceType.BriefJolt,
    InitializeForce( Dev, EffectType.ConstantForce, axis,
    10000, EffectFlags.ObjectOffsets | EffectFlags.Spherical, 250000 ) );
    forces.Add( ForceType.LowRumble,
    InitializeForce( Dev, EffectType.ConstantForce, axis,
    2000, EffectFlags.ObjectOffsets | EffectFlags.Cartesian, 900000 ) );
    forces.Add( ForceType.HardRumble,
    InitializeForce( Dev, EffectType.ConstantForce, axis,
    10000, EffectFlags.ObjectOffsets | EffectFlags.Spherical, 2000000 ) );
    catch ( Exception e ) 
    System.Windows.Forms.MessageBox.Show( "Could not initalize force feedback:\n\n" + e );
    #endregion
    #region DisposeForces
    public static void DisposeForces()
    if ( P1Forces != null )
    foreach ( EffectObject o in P1Forces.Values )
    o.Dispose();
    P1Forces = null;
    if ( P2Forces != null )
    foreach ( EffectObject o in P2Forces.Values )
    o.Dispose();
    P2Forces = null;
    #endregion
    #region SendForce
    public static void SendForce( ForceType Type, bool IsPlayer1 )
    Dictionary<forcetype,> forces;
    if ( IsPlayer1 )
    forces = P1Forces;
    else
    forces = P2Forces;
    if ( forces == null )
    return;
    if ( !forces.ContainsKey( Type ) )
    return;
    EffectObject force = forces[Type];
    force.Start( 1 );
    #endregion
    #region InitializeForce
    public static EffectObject InitializeForce( Device Dev, EffectType Type,
    int[] Axis, int Magnitude, EffectFlags Flags, int Duration )
    EffectObject eo = null;
    Effect e;
    foreach ( EffectInformation ei in Dev.GetEffects( EffectType.All ) )
    if ( DInputHelper.GetTypeCode( ei.EffectType ) == (int)Type )
    e = new Effect();
    e.SetDirection( new int[Axis.Length] );
    e.SetAxes( new int[1] ); 
    //this is the offending line in the Microsoft examples
    //setting axes to 2 causes the dreaded "Value does not fall within expected range" error
    //this is evidently a bug in Managed DirectX, at least affecting some game pads,
    //and this is the only workaround I've found.
    //I have not been able to successfully load FFE files in Managed DirectX
    //due to this same problem (presumably, in the inner initialization code
    //when loading from FFE, it is trying to load two axes there, as well).
    //This problem exists with all verys of Managed DirectX, as far as I can tell,
    //at least up through March 2008 when this example was written.
    e.EffectType = Type;
    e.ConditionStruct = new Condition[Axis.Length];
    e.Duration = Duration;
    e.Gain = 10000;
    e.Constant = new ConstantForce();
    e.Constant.Magnitude = Magnitude;
    e.SamplePeriod = 0;
    e.TriggerButton = (int)Microsoft.DirectX.DirectInput.Button.NoTrigger;
    e.TriggerRepeatInterval = (int)DI.Infinite;
    e.Flags = Flags;
    e.UsesEnvelope = false;
    // Create the effect, using the passed in guid.
    eo = new EffectObject( ei.EffectGuid, e, Dev );
    return eo;
    #endregion

    I was debugging a code and I got it to 1 error.
    It was missing a main method, so I did static void Main(); in the beginning of the code.
    The error says "ffbCS.Program.Main() must declare a body because it is not marked abstract, extern, or partial"
    Does the main method always go in the beginning of the code or can it come after some code? Is there other types of main methods? I used static void
    Main(); because this is the only one that I know of.
    Below is my code
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Collections;
    using System.ComponentModel;
    using System.Device;
    using Microsoft.DirectX;
    using Microsoft.DirectX.DirectInput;
    namespace ffbCS
    class Program
    static void Main();
    public sealed class DirectInputWrapper
    #region ForceType
    ///<summary style="color:#111111;font-family:'Segoe UI', Arial, sans-serif;font-size:14px;line-height:normal;">
    /// This enumeration simply provides a shorthand way to reference
    /// the custom forces we create -- it's not a base part of DirectX,
    /// though, so you can use a completely different method.
    ///</summary>
    public enum ForceType
    VeryBriefJolt,
    BriefJolt,
    LowRumble,
    HardRumble
    #endregion
    //this class lets us send FF commands to up to two game pads,
    //but your own class could support as many as you want
    private static Device device1;
    private static Device device2;
    private static Dictionary<forcetype,> P1Forces;
    private static Dictionary<forcetype,> P2Forces;
    #region Initialize
    ///<summary style="color:#111111;font-family:'Segoe UI', Arial, sans-serif;font-size:14px;line-height:normal;">
    /// Initialize DirectInput
    ///</summary>
    public static void Initialize( System.Windows.Forms.Control Parent )
    if ( device1 != null )
    device1.Dispose();
    device1 = null;
    if ( device2 != null )
    device2.Dispose();
    device2 = null;
    foreach ( DeviceInstance instance in Manager.GetDevices( DeviceClass.GameControl,
    EnumDevicesFlags.AttachedOnly ) )
    if ( device1 == null )
    device1 = new Device( instance.InstanceGuid );
    else if ( device2 == null )
    device2 = new Device( instance.InstanceGuid );
    DisposeForces();
    P1Forces = new Dictionary<forcetype,>();
    P2Forces = new Dictionary<forcetype,>();
    InitializeDevice( Parent, device1 );
    InitializeDevice( Parent, device2 );
    #endregion
    #region InitializeDevice
    private static void InitializeDevice( System.Windows.Forms.Control Parent, Device Dev )
    if ( Dev == null )
    return;
    Dev.SetDataFormat( DeviceDataFormat.Joystick );
    Dev.SetCooperativeLevel( Parent, CooperativeLevelFlags.Background |
    CooperativeLevelFlags.Exclusive );
    Dev.Properties.AxisModeAbsolute = true;
    Dev.Properties.AutoCenter = false;
    Dev.Acquire();
    int[] axis = null;
    // Enumerate any axes
    foreach ( DeviceObjectInstance doi in Dev.Objects )
    if ( ( doi.ObjectId & (int)DeviceObjectTypeFlags.Axis ) != 0 )
    // We found an axis, set the range to a max of 10,000
    Dev.Properties.SetRange( ParameterHow.ById,
    doi.ObjectId, new InputRange( -5000, 5000 ) );
    int[] temp;
    // Get info about first two FF axii on the device
    if ( ( doi.Flags & (int)ObjectInstanceFlags.Actuator ) != 0 )
    if ( axis != null )
    temp = new int[axis.Length + 1];
    axis.CopyTo( temp, 0 );
    axis = temp;
    else
    axis = new int[1];
    // Store the offset of each axis.
    axis[axis.Length - 1] = doi.Offset;
    if ( axis.Length == 2 )
    break;
    Dictionary<forcetype,> forces;
    if ( Dev == device1 )
    forces = P1Forces;
    else
    forces = P2Forces;
    try
    if ( axis != null )
    forces.Add( ForceType.VeryBriefJolt,
    InitializeForce( Dev, EffectType.ConstantForce, axis,
    6000, EffectFlags.ObjectOffsets | EffectFlags.Spherical, 150000 ) );
    forces.Add( ForceType.BriefJolt,
    InitializeForce( Dev, EffectType.ConstantForce, axis,
    10000, EffectFlags.ObjectOffsets | EffectFlags.Spherical, 250000 ) );
    forces.Add( ForceType.LowRumble,
    InitializeForce( Dev, EffectType.ConstantForce, axis,
    2000, EffectFlags.ObjectOffsets | EffectFlags.Cartesian, 900000 ) );
    forces.Add( ForceType.HardRumble,
    InitializeForce( Dev, EffectType.ConstantForce, axis,
    10000, EffectFlags.ObjectOffsets | EffectFlags.Spherical, 2000000 ) );
    catch ( Exception e ) 
    System.Windows.Forms.MessageBox.Show( "Could not initalize force feedback:\n\n" + e );
    #endregion
    #region DisposeForces
    public static void DisposeForces()
    if ( P1Forces != null )
    foreach ( EffectObject o in P1Forces.Values )
    o.Dispose();
    P1Forces = null;
    if ( P2Forces != null )
    foreach ( EffectObject o in P2Forces.Values )
    o.Dispose();
    P2Forces = null;
    #endregion
    #region SendForce
    public static void SendForce( ForceType Type, bool IsPlayer1 )
    Dictionary<forcetype,> forces;
    if ( IsPlayer1 )
    forces = P1Forces;
    else
    forces = P2Forces;
    if ( forces == null )
    return;
    if ( !forces.ContainsKey( Type ) )
    return;
    EffectObject force = forces[Type];
    force.Start( 1 );
    #endregion
    #region InitializeForce
    public static EffectObject InitializeForce( Device Dev, EffectType Type,
    int[] Axis, int Magnitude, EffectFlags Flags, int Duration )
    EffectObject eo = null;
    Effect e;
    foreach ( EffectInformation ei in Dev.GetEffects( EffectType.All ) )
    if ( DInputHelper.GetTypeCode( ei.EffectType ) == (int)Type )
    e = new Effect();
    e.SetDirection( new int[Axis.Length] );
    e.SetAxes( new int[1] ); 
    //this is the offending line in the Microsoft examples
    //setting axes to 2 causes the dreaded "Value does not fall within expected range" error
    //this is evidently a bug in Managed DirectX, at least affecting some game pads,
    //and this is the only workaround I've found.
    //I have not been able to successfully load FFE files in Managed DirectX
    //due to this same problem (presumably, in the inner initialization code
    //when loading from FFE, it is trying to load two axes there, as well).
    //This problem exists with all verys of Managed DirectX, as far as I can tell,
    //at least up through March 2008 when this example was written.
    e.EffectType = Type;
    e.ConditionStruct = new Condition[Axis.Length];
    e.Duration = Duration;
    e.Gain = 10000;
    e.Constant = new ConstantForce();
    e.Constant.Magnitude = Magnitude;
    e.SamplePeriod = 0;
    e.TriggerButton = (int)Microsoft.DirectX.DirectInput.Button.NoTrigger;
    e.TriggerRepeatInterval = (int)DI.Infinite;
    e.Flags = Flags;
    e.UsesEnvelope = false;
    // Create the effect, using the passed in guid.
    eo = new EffectObject( ei.EffectGuid, e, Dev );
    return eo;
    #endregion

  • LabVIEW could not generate code for the shared variable.You must open the VI in the project that contains the library where the shared variable resides

    HI
    When I put a network shared variable with fifo RT activated on my diagram, the arrow is broken.and I' ve got this message:
    ""LabVIEW could not generate code for the shared variable.You must open the VI in the project that contains the library where the shared variable resides""
    If I uncheck FIFO RT option for this variable the arrow isn't broken anymore.
    I 've no idea how to correct this weird error?
    Autodeploy is on, and I've check copy / delete in diagram in tool/options\diagram
    regards,
    james

    Hello,
    I don't reproduce this error.
    Could you send your VI?
    Regards
    VéroniqueD
    NI France

Maybe you are looking for

  • Using GF 680GTX 4GB with Premiere Pro CS6

    I am thinking in buying the GF 680GTX 4gb to use it with Premiere Pro CS6, but I've just discovered it's not compatible as a GPU Accelerator. Is there any way I can make it work with the program? Thanks in advance!

  • [Solved] How to save a file in /usr/bin/local using gedit as an admin?

    In my attempt to run these two programs: https://github.com/kerchen/export_gr2evernote https://github.com/spiermar/bookmarks2evernote I noticed they assumed the default python is python 2. I have python 3.3.1 and 2.6.8. I'm following the instructions

  • How to change the Discussion board view to facebook posting type view

    hi friends.. i want to change the discussion board view to facebook posting type.Where multiple discussions and comments on single page as well as all the comments should be in a threaded view and also i want to find a new discussion link in same pag

  • Adobe Flash requesting Action for every page

    I'm running Firefox 19.02 and a new problem has now developed. Every time I visit a new page a pop up requests action to allow Adobe Flash for that page, it doesn't matter how many time you tell it to accept for every page, it refuses to remember it.

  • MDT 2012 bypass choosing image to deploy

    hello is there any parameter in customsetting.ini or anywhere else where we can specify image we want to deploy to avoiding it in the MDT console thanks