Showing posts with label servers. Show all posts
Showing posts with label servers. Show all posts

Wednesday, March 7, 2012

how is "available servers" list populated

When registering a new SQL Server in EM using the wizard a window appears that is supposed to list available SQL Servers, however it does not.
So, my question is:
How is this list derived? and how can the list be managed?How is the list derived is easy (http://support.microsoft.com/default.aspx?scid=kb;en-us;287737). How can the list be managed gets really complicated! What are you looking to acheive in the way of "managing" the list?

-PatP|||Pat,
If you can give me how it is populated I'll work through the part of being mangeable. I'm dealing with servers in several domains clients scattered accross the company. So an answer to the first question of how it is derived would much appreciated. Thanks.|||Sorry Pat I missed your link the first time.

OK, so this executable would list the available SQL Servers on the local network segment, does this mean it would not detect servers residing on other subnets (hence the use of "local")?|||It can't tell you about what it can't see. And it has to have a narrow view, thus local is relative but applicable.

Do the math - if it tried to enumerate every server and you had an internet connection (I hear these are popular), you'd end up launching SQLEM first thing in the morning, taking coffee, water, and other types of breaks, eating lunch, playing in a cricket tournament, starting a family, experiencing a mid-life crisis, then retiring and returning to discover other servers were missed because they were added while it was enumerating.

Sunday, February 19, 2012

How I can copy object SMO between DB and servers?

Something following is necessary:

Column c1 = srv1.Databases[“db1”].Tables[“t1”].Columns[“c1”];

Column c2 = <something which copies c1>

srv2.ConnectionContext.SqlExecutionModes = SqlExecutionModes.CaptureSql;

srv2.ConnectionContext.CapturedSql.Clear();

srv2.Databases[“db1”].Tables[“t1”].Columns.Add( c2 );

foreach( string s in srv2.ConnectionContext.CapturedSql.Text )

{

Debug.WriteLine( s );

}

srv2.ConnectionContext.SqlExecutionModes = SqlExecutionModes.ExecuteSql;

Really it is necessary to make copying all properties of c1 in {c2 = new Column()} ?

And the similar question: How to make so that the existing column in db1 would begin by the same as in db2? And to obtain the script of this.

I write the program of the comparison of DB structures. Comparison already works. But here with scripting arose problems.

I think you try to generate the change script. Setting all properties is needed in that case.

|||

Thanks, Michiel

I searched for the universal method of copying, for example the properties of column. Something like this:

Column c1 = db1.Tables[“t1”];

Column c2 = new Column();

c2.Parent = db2.Tables[“t2”];

c2.CopyPropertiesFrom( c1 );

or

c2.ToMakeSimilarOn( c1 );

Such is necessary in my case. It is to be regretted that it does not exist.

I tried to write something like:

Column c1 = srv.Databases["db1"].Tables["t1"].Columns["col"];

Column c2 = new Column( srv.Databases["db2"].Tables["t1"], c1.Name );

c2.DataType = c1.DataType;

foreach( Property p in c1.Properties )

{
if( !p.Dirty && p.Readable && p.Retrieved && p.Writable && !p.IsNull )

{

c2.Properties[p.Name].Value = p.Value;

}

}

But, as it proved to be - this is incorrect approach.

And I, enormous thanks for your Weblog.