Showing posts with label across. Show all posts
Showing posts with label across. Show all posts

Friday, March 30, 2012

Problem with cascading deletion (circular)

Problem with cascading deletion (circular)

Hi, I am reletively new to DB programming and have come across a fairly poorly designed DB. I am trying to set up cascating deletes and triggers in such a way that if the application deletes an entry in Table A then all the associate data in table B through H will also be deleted. However because of SQL Server 2005 restrictions on Cascading deletes and the cycles in the involved tables I have not been able to do it. Does anyone have some tips or suggestions?

Here is the basic design:

Table A
Table B
Table C
Table D
Table E
Table F
Table G
Table H

Relationships

1) Table B --> Table A
2) Table C --> Table B
3) Table D --> Table B
4) Table E --> Table C
5) Table E --> Table D
6) Table F --> Table E
7) Table F --> Table G
8) Table H --> Table G
9) Table H --> Table B

I can get cascading deletes for relationships 1 to 4 but once I try 5 it
recognizes the B-C-D-E cycle.

Circular cascading deletes are not allowed.

You may be able to use triggers instead.

FROM The Books Online topic:

Cascading Referential Integrity Constraints

Multiple Cascading Actions

Individual DELETE or UPDATE statements can start a series of cascading referential actions. For example, a database contains three tables: TableA, TableB, and TableC. A foreign key in TableB is defined with ON DELETE CASCADE against the primary key in TableA. A foreign key in TableC is defined with ON DELETE CASCADE against the primary key in TableB. If a DELETE statement deletes rows in TableA, the operation also deletes any rows in TableB that have foreign keys matching the deleted primary keys in TableA, and then deletes any rows in TableC that have foreign keys that match the deleted primary keys in TableB.

The series of cascading referential actions triggered by a single DELETE or UPDATE must form a tree that contains no circular references. No table can appear more than one time in the list of all cascading referential actions that result from the DELETE or UPDATE. Also, the tree of cascading referential actions must not have more than one path to any specified table. Any branch of the tree is ended when it encounters a table for which NO ACTION has been specified or is the default.

I think the Advanced Transact SQL Book by Tom Moreau and Itzik Ben-Gan has some design info around this.

Tuesday, March 20, 2012

Problem wiht merge replication using pull subscription across internet

Hi,
I want to use merge replication will pull subscription across
internet.
I have 2 computers with SQL Server 2005.
Computer A is the main computer that will have the publication.
Computer B will have a subscription to the Computer A publication.
The distributor will be in Computer B.
Computer A is behind a firewall. The firewall has the following rules
for incoming traffic:
everything denied for all IPs except for the following ports:
20 TCP
21 TCP
22 TCP
23 TCP
25 TCP
53 TCP, UDP
80 TCP
81 TCP
110 TCP
143 TCP
443 TCP
444 TCP
554 TCP
1433 TCP
1755 TCP,UDP
3306 TCP
3389 TCP
5432 TCP
5005 UDP
5800 TCP
5900 TCP
8443 TCP
10000 TCP
25112 TCP
And the following rules for outgoing traffic:
everything denied for all IPs except for the following ports:
20 TCP
21 TCP
22 TCP
23 TCP
25 TCP
53 TCP,UDP
80 TCP
110 TCP
123 UDP
143 TCP
443 TCP
1433 TCP
3306 TCP
5432 TCP
Before trying to set up replication I tried to connect from SSMS from
computer B to A and it worked.
However, trying to connect from SSMS in computer A to computer B
didn't worked.
If I try to connect from another computer (that is not behind the
firewall) to computer B it works.
My question is what outgoing ports need to be opened in the firewall
that protects computer A in order to connect to the SQL Server
instance in computer B?
Will I need to modify my firewall setup if I used push subscription
instead of pull subscription?
Thanks
You would need to open port 1433 for outbound to connect to server b. For a
push server A would connect to its own snapshot share, so this should work
over part 1433 as well.
I would recommend using pull however.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Manu" <manunews@.gmail.com> wrote in message
news:1171023660.026202.308300@.a75g2000cwd.googlegr oups.com...
> Hi,
> I want to use merge replication will pull subscription across
> internet.
> I have 2 computers with SQL Server 2005.
> Computer A is the main computer that will have the publication.
> Computer B will have a subscription to the Computer A publication.
> The distributor will be in Computer B.
> Computer A is behind a firewall. The firewall has the following rules
> for incoming traffic:
> everything denied for all IPs except for the following ports:
> 20 TCP
> 21 TCP
> 22 TCP
> 23 TCP
> 25 TCP
> 53 TCP, UDP
> 80 TCP
> 81 TCP
> 110 TCP
> 143 TCP
> 443 TCP
> 444 TCP
> 554 TCP
> 1433 TCP
> 1755 TCP,UDP
> 3306 TCP
> 3389 TCP
> 5432 TCP
> 5005 UDP
> 5800 TCP
> 5900 TCP
> 8443 TCP
> 10000 TCP
> 25112 TCP
> And the following rules for outgoing traffic:
> everything denied for all IPs except for the following ports:
> 20 TCP
> 21 TCP
> 22 TCP
> 23 TCP
> 25 TCP
> 53 TCP,UDP
> 80 TCP
> 110 TCP
> 123 UDP
> 143 TCP
> 443 TCP
> 1433 TCP
> 3306 TCP
> 5432 TCP
> Before trying to set up replication I tried to connect from SSMS from
> computer B to A and it worked.
> However, trying to connect from SSMS in computer A to computer B
> didn't worked.
> If I try to connect from another computer (that is not behind the
> firewall) to computer B it works.
> My question is what outgoing ports need to be opened in the firewall
> that protects computer A in order to connect to the SQL Server
> instance in computer B?
> Will I need to modify my firewall setup if I used push subscription
> instead of pull subscription?
> Thanks
>
|||Hilary,
I had the port 1433 open for outbound connections in server A but it
wasn't working. I was using a named instance in server B with dynamic
ports so after setting the server B to use the port 1433 I can connect
from server A to server B.
Now I'm trying to configure the merge replication (fingers crossed).
Thanks for the help,
Manu
Hilary Cotter wrote:[vbcol=seagreen]
> You would need to open port 1433 for outbound to connect to server b. For a
> push server A would connect to its own snapshot share, so this should work
> over part 1433 as well.
> I would recommend using pull however.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "Manu" <manunews@.gmail.com> wrote in message
> news:1171023660.026202.308300@.a75g2000cwd.googlegr oups.com...

Monday, February 20, 2012

PROBLEM- Use parameter to populate field in headerpage

Hi all,
I use hidden report parameters to populate textboxes in the pageheader and
come across this problem.
When the query for the default value for a parameter returns no rows, I get
an error "Parameter validation failed. It is not possible to provide valid
values for all parameters. (rsParameterError)".
This error is expected in this case. My question is is there a way to get
around this?
ThanksIn the query for the parameters dataset, force a record to be returned.
Union is a good function for this. I.e.,
Select Name From Table1 Where Type = 'whatever'
UNION
Select '(blank)'
Or you could do
If Exists(Select * From Table1 Where Type = 'whatever')
Select Name From Table1 Where Type = 'whatever'
Else
Select '(blank)' As Name
First option is more efficient but may have side effects for you.
Chris
Bach wrote:
> Hi all,
> I use hidden report parameters to populate textboxes in the
> pageheader and come across this problem.
> When the query for the default value for a parameter returns no rows,
> I get an error "Parameter validation failed. It is not possible to
> provide valid values for all parameters. (rsParameterError)".
> This error is expected in this case. My question is is there a way to
> get around this?
> Thanks