Showing posts with label hierarchy. Show all posts
Showing posts with label hierarchy. Show all posts

Tuesday, March 27, 2012

Deleting Parameter Error

I have a report with 2 parameters, that are part of a hierarchy, that I want
to delete. I delete the query parameter via the designer and the query
mapping dialog and then the report parameters. When I build I get an error
saying the the query parameter I have deleted cannot find the the deleted
reporting parameter. In other situations this deletion seems to work - could
the hierarchy be a factor. This is SO frustrating. Can anyone point me in
the right direction or is it a bug. Regards, Chris.open up the file in XML and do a search on the deleted parameter name. that
will help you find where to look in the designer.
Basically there are three general places for parameters to live, in the
Report Parameters applet; Data Source -->parameters tab or Data Source Text
window depending on whether you are using a sproc or sql code; and in text
boxes in the layout, usually in the header section.
the easiest place to over look is the layout where sometimes parameters are
sometimes displayed or used as filters.
"Fresno Bob" wrote:
> I have a report with 2 parameters, that are part of a hierarchy, that I want
> to delete. I delete the query parameter via the designer and the query
> mapping dialog and then the report parameters. When I build I get an error
> saying the the query parameter I have deleted cannot find the the deleted
> reporting parameter. In other situations this deletion seems to work - could
> the hierarchy be a factor. This is SO frustrating. Can anyone point me in
> the right direction or is it a bug. Regards, Chris.
>
>|||I wouldn't know what to do with the report in XML format. I have looked in
there an I can see the parameter cropping as a query parameter in an
unrelated report parameter.
"Carl Henthorn" <CarlHenthorn@.discussions.microsoft.com> wrote in message
news:4EFB8F4F-0670-4898-B557-F1AB625CE083@.microsoft.com...
> open up the file in XML and do a search on the deleted parameter name.
> that
> will help you find where to look in the designer.
> Basically there are three general places for parameters to live, in the
> Report Parameters applet; Data Source -->parameters tab or Data Source
> Text
> window depending on whether you are using a sproc or sql code; and in text
> boxes in the layout, usually in the header section.
> the easiest place to over look is the layout where sometimes parameters
> are
> sometimes displayed or used as filters.
> "Fresno Bob" wrote:
>> I have a report with 2 parameters, that are part of a hierarchy, that I
>> want
>> to delete. I delete the query parameter via the designer and the query
>> mapping dialog and then the report parameters. When I build I get an
>> error
>> saying the the query parameter I have deleted cannot find the the deleted
>> reporting parameter. In other situations this deletion seems to work -
>> could
>> the hierarchy be a factor. This is SO frustrating. Can anyone point me in
>> the right direction or is it a bug. Regards, Chris.
>>

Friday, February 24, 2012

delete rows by checking conditions in more than one column

Hi All,

I have tables in three hierarchy...
I need to delete rows from the table which in 3rd level of hierarchy.

For ex: Table 1 has primary key col1.
Table 2 has primary key Col2 and Foreign key COL1 and
Table 3 has primary key Col3 and Foregn key Col2.

Now I have to delete all the rows in table three where Table3.Col2=Table2.Col2
and Table2.Col1=Table1.Col1

I could insert successfully using this condition but I am unable to delete.
I tried nested queries but it fails as the sub query returns more than one row.

Please help me how to overcome this.
An example is more helpful.

Thank you
Madhavi

Quote:

Originally Posted by madhavi123

Hi All,

I have tables in three hierarchy...
I need to delete rows from the table which in 3rd level of hierarchy.

For ex: Table 1 has primary key col1.
Table 2 has primary key Col2 and Foreign key COL1 and
Table 3 has primary key Col3 and Foregn key Col2.

Now I have to delete all the rows in table three where Table3.Col2=Table2.Col2
and Table2.Col1=Table1.Col1

I could insert successfully using this condition but I am unable to delete.
I tried nested queries but it fails as the sub query returns more than one row.

Please help me how to overcome this.
An example is more helpful.

Thank you
Madhavi


Please don't post questions in the articles section.
Moved to the forum.

Friday, February 17, 2012

DELETE problem

I have a hierarchy of menu and sub menus setup using this table:
CREATE TABLE menu
(
id INT NOT NULL IDENTITY PRIMARY KEY,
name VARCHAR(30)NOT NULL,
parentID INTNULL --Null If Root Menu
)

I want all sub menus to be deleted when a parent menu is deleted. I
wasn't able to get a recursive procedure to work because I got an error
about multiple cursors w/ the same name.

The best I've come up w/ is this:

DELETE FROM menu WHERE id = x --Del Menu
--Cleanup Children
DELETE FROM menu WHERE parentID <> NULL AND parentID NOT IN(SELECT id
from menu)

Is there a better/faster way of doing this?Hi

If you did not see my reply to your previous post, the following is about
the best you can do

DELETE FROM menu WHERE id = x --Del Menu

WHILE @.@.ROWCOUNT > 0
BEGIN
DELETE FROM menu
WHERE parentID IS NOT NULL
AND parentID NOT IN (SELECT id FROM menu)
END

Do not use <> NULL

John

<wackyphill@.yahoo.com> wrote in message
news:1103306757.201621.73930@.z14g2000cwz.googlegro ups.com...
>I have a hierarchy of menu and sub menus setup using this table:
> CREATE TABLE menu
> (
> id INT NOT NULL IDENTITY PRIMARY KEY,
> name VARCHAR(30) NOT NULL,
> parentID INT NULL --Null If Root Menu
> )
> I want all sub menus to be deleted when a parent menu is deleted. I
> wasn't able to get a recursive procedure to work because I got an error
> about multiple cursors w/ the same name.
> The best I've come up w/ is this:
> DELETE FROM menu WHERE id = x --Del Menu
> --Cleanup Children
> DELETE FROM menu WHERE parentID <> NULL AND parentID NOT IN(SELECT id
> from menu)
> Is there a better/faster way of doing this?|||John Bell wrote:
> Hi
> If you did not see my reply to your previous post, the following is
about
> the best you can do
> DELETE FROM menu WHERE id = x --Del Menu
> WHILE @.@.ROWCOUNT > 0
> BEGIN
> DELETE FROM menu
> WHERE parentID IS NOT NULL
> AND parentID NOT IN (SELECT id FROM menu)
> END
> Do not use <> NULL
> John
> <wackyphill@.yahoo.com> wrote in message
> news:1103306757.201621.73930@.z14g2000cwz.googlegro ups.com...
> >I have a hierarchy of menu and sub menus setup using this table:
> > CREATE TABLE menu
> > (
> > id INT NOT NULL IDENTITY PRIMARY KEY,
> > name VARCHAR(30) NOT NULL,
> > parentID INT NULL --Null If Root Menu
> > )
> > I want all sub menus to be deleted when a parent menu is deleted. I
> > wasn't able to get a recursive procedure to work because I got an
error
> > about multiple cursors w/ the same name.
> > The best I've come up w/ is this:
> > DELETE FROM menu WHERE id = x --Del Menu
> > --Cleanup Children
> > DELETE FROM menu WHERE parentID <> NULL AND parentID NOT IN(SELECT
id
> > from menu)
> > Is there a better/faster way of doing this?|||Thanks, John. That works great!|||Sorry John I did miss your last post and you are right, that works very
well. Thank you very much.|||Look up the nested sets model for trees; this can be done without
procedural code.