Showing posts with label range. Show all posts
Showing posts with label range. Show all posts

Friday, March 9, 2012

fail to change the value of parameter with operator 'range'

Hi all,

I have couple of paramters with operator 'range(inclusive)' in my report(Agains datacube), and I always get failure when I choose value with them. here's a example( 3 such parameters on my report).

...

From date To Date

...

From age To Age

...

From Salary To Salary

@.salary is the last one.

when i choose a value for 'From Salary' or 'To Salary' from the dropdown list, it runs correctly. But if I choose value for 'from age' or 'To age' or 'From Date' or 'To Date', it fails due to

  • An error has occurred during report processing. (rsProcessingAborted)

  • Query execution failed for data set 'DimTimesheetTimesheetNumber'. (rsErrorExecutingCommand)

  • Range operator ( : ) operands have different levels; they must be the same.

    BTW, all the default values for these parameters are 'all', since it allows only 'all' to select when I set up the parameters, and I tried to change the default value, but it caused errors about the parameter dependency.

    Any idea and suggestion will be appreciated!

    Jone

    Anybody has any idea?

    Thanks,

  • Friday, February 24, 2012

    extracting the specified record no of records from database table

    hi all,

    I need to select the no of records on the basis of specified range of records.

    In oracle i found rownum, i could not find it in sqlserver. how the data are extracted from the huge records..

    I have used temporary table,map the table primary key to the next table with identity

    but i dont find it good. I need to ignore the insert the data in next table or craeting new table having the rowid ...

    Is there some other best way to extract the specified data

    here is the type of query.

    select * from customers where rownum between 1000 and 10000

    this is in oracle

    i am in need to do this in the sql server

    waiting for the response...............................

    There is no such thing like row number in MS SQL. You will need to create an identity column in your table, or maintain the number column manually.|||

    If you are using SQL Server 2005 then you can use the ROW_NUMBER() function instead:

    select *

    from (select *, row_number() over(order by CustomerId) as rownum

    from customers

    ) as c

    where c.rownum between 1000 and 10000;

    If you are using SQL Server 2000 then the identity column approach using temporary table is the best way to go (I guess you are doing this now based on the information in your post).

    Also, it seems like you are trying to batch some DML operation. If so you can use SET ROWCOUNT or TOP clause in DML (SQL Server 2005). See below for example:

    declare @.n int

    set @.n = 1000 -- set number of rows you want to insert at a time

    set rowcount @.n

    while(1=1)

    begin

    insert into MasterCustomers

    select ...

    from Customers as c1

    where not exists(

    select * from MasterCustomers as c2

    where c2.CustomerName = c1.CustomerName)

    if @.@.rowcount = 0 break

    end

    set rowcount 0

    -- using TOP

    declare @.n int

    set @.n = 1000 -- set number of rows you want to insert at a time

    while(1=1)

    begin

    insert top(@.n) into MasterCustomers

    select ...

    from Customers as c1

    where not exists(

    select * from MasterCustomers as c2

    where c2.CustomerName = c1.CustomerName)

    if @.@.rowcount = 0 break

    end

    |||SQL 2000 does not have the limit keyord. You can use double TOP instead of, but you must have a primary key on that table
    select * from
    (select top 1000 * from (
    select top 11000 *
    from customers
    order by customer_id asc
    ) as tmp1
    order by cutomer_id desc
    ) as tmp2
    order by ...

    for extract customers betweeen 10000 and 11000 based on customer_id
    |||

    if you use sql2005

    you also can use the function ROW_NUMBER() to

    select rownum between 1000 and 10000 like oracle

    example:

    with customers _temp as

    (SELECT ROW_NUMBER() OVER (order by customer) as RowNumber,*
    from customers)
    select *
    from customers _temp
    where RowNumber between 1000 and 10000

    extracting the specified record no of records from database table

    hi all,

    I need to select the no of records on the basis of specified range of records.

    In oracle i found rownum, i could not find it in sqlserver. how the data are extracted from the huge records..

    I have used temporary table,map the table primary key to the next table with identity

    but i dont find it good. I need to ignore the insert the data in next table or craeting new table having the rowid ...

    Is there some other best way to extract the specified data

    here is the type of query.

    select * from customers where rownum between 1000 and 10000

    this is in oracle

    i am in need to do this in the sql server

    waiting for the response...............................

    There is no such thing like row number in MS SQL. You will need to create an identity column in your table, or maintain the number column manually.|||

    If you are using SQL Server 2005 then you can use the ROW_NUMBER() function instead:

    select *

    from (select *, row_number() over(order by CustomerId) as rownum

    from customers

    ) as c

    where c.rownum between 1000 and 10000;

    If you are using SQL Server 2000 then the identity column approach using temporary table is the best way to go (I guess you are doing this now based on the information in your post).

    Also, it seems like you are trying to batch some DML operation. If so you can use SET ROWCOUNT or TOP clause in DML (SQL Server 2005). See below for example:

    declare @.n int

    set @.n = 1000 -- set number of rows you want to insert at a time

    set rowcount @.n

    while(1=1)

    begin

    insert into MasterCustomers

    select ...

    from Customers as c1

    where not exists(

    select * from MasterCustomers as c2

    where c2.CustomerName = c1.CustomerName)

    if @.@.rowcount = 0 break

    end

    set rowcount 0

    -- using TOP

    declare @.n int

    set @.n = 1000 -- set number of rows you want to insert at a time

    while(1=1)

    begin

    insert top(@.n) into MasterCustomers

    select ...

    from Customers as c1

    where not exists(

    select * from MasterCustomers as c2

    where c2.CustomerName = c1.CustomerName)

    if @.@.rowcount = 0 break

    end

    |||SQL 2000 does not have the limit keyord. You can use double TOP instead of, but you must have a primary key on that table
    select * from
    (select top 1000 * from (
    select top 11000 *
    from customers
    order by customer_id asc
    ) as tmp1
    order by cutomer_id desc
    ) as tmp2
    order by ...

    for extract customers betweeen 10000 and 11000 based on customer_id|||

    if you use sql2005

    you also can use the function ROW_NUMBER() to

    select rownum between 1000 and 10000 like oracle

    example:

    with customers _temp as

    (SELECT ROW_NUMBER() OVER (order by customer) as RowNumber,*
    from customers)
    select *
    from customers _temp
    where RowNumber between 1000 and 10000