Showing posts with label setting. Show all posts
Showing posts with label setting. Show all posts

Friday, March 30, 2012

passing or defaulting null

I wanted to know what are the advantages/divantages of passing null value
s
in the sp as oppose to setting them as default in the tables.
I am using SQL 2005, "set ANSI_NULLS ON".
ThanksMumbai_Chef wrote:
> I wanted to know what are the advantages/divantages of passing
> null values in the sp as oppose to setting them as default in the
> tables.
> I am using SQL 2005, "set ANSI_NULLS ON".
>
If you have, for example, a DateEntered column, which will always need to be
initialized to the current date and time when a row is inserted and never
subsequently updated, then by all means create a default constraint for the
column. This allows you to never even have to mention the column in any
UPDATE/INSERT DML queries, and as a result, you never have to declare a
parameter for this columns value in any of your procedures.
On the other hand, if you have a column for which you will sometimes be
providing a non-default value, then obviously you will need to include a
parmaeter for that value in your stored procedures. Whether or not you
declare the parameter with a default value (making it an optional parameter)
is totally up to you.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Monday, February 20, 2012

Partner works from mirror to principal, but not vice versa.

We were having problems setting up the mirroring, so I did it via command lines. I found out the "alter...set partnership" command works on the mirror server going to the principal, but gets a 1418 error when going from the principal to the mirror.

So if A is the principal and B is the mirror, A to B fails but B to A works.

If I reverse it so that B is the principal and A is the mirror, B to A fails and A to B works.

Any suggestions?

Here’s an update on our problem.

We are now doing it thru Management Studio. We set up the mirroring, but answer “no” when it asks to start mirroring and go back to the mirroring screen. One of the default names contains the domain but the other does not.

We replace the address field with the IP addresses for the Principal and Mirror Network Addresses (no witness). When we click on “start mirroring”, the Principal’s name gets changed back to the dns name, but the mirror name remains an IP address. This is true even when we switch which server is the principal and which the mirror.

It seems to me that because it always happens the same way for the mirror and principal addresses, regardless of the server, that this might be a bug.

|||

Fixed it!

We did two things:

- Went to C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys and set the administrators permission to Full Control and

- Edited the C:\WINDOWS\system32\drivers\etc\hosts file on each server to include

IP addressDNSname

For each server.

Partner works from mirror to principal, but not vice versa.

We were having problems setting up the mirroring, so I did it via command lines. I found out the "alter...set partnership" command works on the mirror server going to the principal, but gets a 1418 error when going from the principal to the mirror.

So if A is the principal and B is the mirror, A to B fails but B to A works.

If I reverse it so that B is the principal and A is the mirror, B to A fails and A to B works.

Any suggestions?

Here’s an update on our problem.

We are now doing it thru Management Studio. We set up the mirroring, but answer “no” when it asks to start mirroring and go back to the mirroring screen. One of the default names contains the domain but the other does not.

We replace the address field with the IP addresses for the Principal and Mirror Network Addresses (no witness). When we click on “start mirroring”, the Principal’s name gets changed back to the dns name, but the mirror name remains an IP address. This is true even when we switch which server is the principal and which the mirror.

It seems to me that because it always happens the same way for the mirror and principal addresses, regardless of the server, that this might be a bug.

|||

Fixed it!

We did two things:

- Went to C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys and set the administrators permission to Full Control and

- Edited the C:\WINDOWS\system32\drivers\etc\hosts file on each server to include

IP addressDNSname

For each server.