Showing posts with label original. Show all posts
Showing posts with label original. Show all posts

Sunday, March 25, 2012

Can not create new replication after changing server name

After i changed my computer's name(eg. the original computer name is 'SERVER-1',I has changed it to 'SERVER-2'),I can not create a new replication in SQL Server 2005.The error message :

New Publication Wizard
SQL Server is unable to connect to server 'SERVER-2'.

SQL Server replication requires the actual server name to make a connection to the server. Connections through a server alias, IP address, or any other alternate name are not supported. Specify the actual server name, 'SERVER-1'. (Replication.Utilities)

What's wrong?Tongue Tied
Should I reinstall SQL Server 2005?


Hi, microzt,

It's possible to rename machine name with SQL Server 2005 installed and have SQL Server 2005 works correctly with the new machine name, however, there are some extra steps need to be performed to accomplish this besides simply renamed the machine name in OS and it only works when you don't have replication enabled before the server renaming (i.e. no distributor is setup, no publications etc).

You need to update sys.servers system catalog view with the new machine name after you renamed the OS machine name:

This can also be done if you use dedicated Admin connection (sqlcmd -A) to update sys.servers (sqlserver need to be started in single user mode for the update to work, otherwise, you will hit error that system catalog view can not be updated manually)

C:\>sqlcmd -A
1> update sys.servers set name='SERVER-2'
2> go

(1 rows affected)
Warning: System table ID 43 has been updated directly in database ID 1 and cache coherence may not h
ave been maintained. SQL Server should be restarted.
1> exit

After you successfully updated sys.servers (or sysservers), replication can be enabled correctly on the renamed SQL Server instance.

Hope That helps.

Zhiqiang

|||

The other way of change server name in sys.servers catalog view is to use sp_dropserver and sp_addserver, for example:

sp_dropserver @.server='SERVER-1'
sp_addserver @.server='SERVER-2', @.local='LOCAL'

Then restart SQL Server service and replication should work fine.

|||Thank you for your help!
The replication work fine now.Big Smile

Can not create Maintenance Plan - getting error message

I just setup two new SQL 2005 Stnd x64bit servers for a customer. The
original two servers running the same SQL version have been running
fine for 3 weeks now. The mian production database is attached and SQL
seems to be working fine. When I try to create a new Maintenance Plan
or use the Maint Plan wizard, I get an error message.
The error message:
TITLE: Microsoft SQL Server Management Studio
--
The action you attempted to perform on a remote instance of SQL Server
has failed because the action requires a SQL Server component that is
not installed on the remote computer. To proceed, install SQL Server
2005 Management Tools on the remote computer, and then try again. For
more information, see "How to: Install SQL Server 2005 (Setup)" in SQL
Server 2005 Books Online, or find the article on MSDN at
http://go.microsoft.com/fwlink/?LinkID=57083 . (ObjectExplorer)
For help, click: http://go.microsoft.com/fwlink/?LinkID=57083
----
I did run SCW on the new servers just like I did on the two original
servers.
Any thoughts? ThanksHi,
I get the exact same error - have you found a solution for your problem
yet?
My setup is a 2 node cluster with SQL 2005 SP1
Regards
Jon skrev:
> I just setup two new SQL 2005 Stnd x64bit servers for a customer. The
> original two servers running the same SQL version have been running
> fine for 3 weeks now. The mian production database is attached and SQL
> seems to be working fine. When I try to create a new Maintenance Plan
> or use the Maint Plan wizard, I get an error message.
> The error message:
> TITLE: Microsoft SQL Server Management Studio
> --
> The action you attempted to perform on a remote instance of SQL Server
> has failed because the action requires a SQL Server component that is
> not installed on the remote computer. To proceed, install SQL Server
> 2005 Management Tools on the remote computer, and then try again. For
> more information, see "How to: Install SQL Server 2005 (Setup)" in SQL
> Server 2005 Books Online, or find the article on MSDN at
> http://go.microsoft.com/fwlink/?LinkID=57083 . (ObjectExplorer)
> For help, click: http://go.microsoft.com/fwlink/?LinkID=57083
> ----
> I did run SCW on the new servers just like I did on the two original
> servers.
> Any thoughts? Thanks

Thursday, March 8, 2012

Can i use the OleDbDataAdapter with SQL SERVER EXPRESS

i have a large amount of code to convert (over 100 asp ver. 2 pages)

Microsoft Access to SQL SERVER EXPRESS

the original code uses the OleDbDataAdapter

example: =========

Dim Connect As OleDbConnection = New OleDbConnection
Dim MyAdapter As OleDbDataAdapter = New OleDbDataAdapter
Dim MyCmdbuilder As OleDbCommandBuilder
Dim Mydataset As DataSet = New DataSet
Dim SelectStatement as string = "select * from tbl_weblog"
Dim connectString as string = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=e:\web\users\data\abc.mdb"

Connect.ConnectionString = ConnectString
MyAdapter.SelectCommand = new OleDbCommand(SelectStatement, Connect)
MyCmdbuilder = New OleDbCommandBuilder(MyAdapter)
MyAdapter.Fill(Mydataset,"tbl_weblog")

================

Can i just change the connection string to point to the new database, assuming the field names and structures are all the same.

Yes, you can, but it's not optimal. The native SqlClient is much better. You could just replace every occurance (search & replace in VS) of "OleDb" with "Sql", and take it from there.

|||

Thanks for the reply

Are there big differences between the Oledb and SQL Client?

You say "much better", in what areas?

reliabilty, scalability or performance?

Does anyone know where i could research this further?

|||

Sorry for being too brief...

The performance difference can be huge in some occasions, and you get nice features such as named parameters.


Tuesday, February 14, 2012

Can I query XML data in SQL Server 2005 and get aggregate information? If so, how?

Is there some way of storing XML in SQL Server 2005 as "pure" XML as,
say, an XML order per record (unshredded to extract the original data )
and then querying the XML to get aggregate information on individual
orders (e.g. sum of cost of all items in order) and then further
aggregating the information to get, say, quarterly results (e.g. sum of
cost of all items ordered from January 2005 to March 2005)? If the
answer to this is yes, and I don't expect it to be, how is this done
(i.e. can someone point me to information on how I could implement such
a thing)? Believe it or not, we can only get this information in XML
format. We would have to pay someone to design a relational database to
take this information, write a script to unshred the data from the XML
and populate the database tables, and then write queries to extract
aggregate data from the database.
You can store the data as XML by using the new xml data type. This data
type has various methods that you can use to query the data. The methods
include some XQuery based functions to extract information from an xml
column or variable (the "query", "value", and "exist" methods), which might
help if your aggergated data also needs to be in XML format. Alternatively,
theres a "nodes" method that you can use to extract a rowset from an xml
value (or you could use OPENXML). You can even create indexes on the xml
columns to improve XQuery performance.
All of this is described in SQL Server Books Online, and
http://msdn.microsoft.com/sql/learn/...l/default.aspx is a good place to
start.
-
Cheers,
Graeme
_____________________
Graeme Malcolm
Principal Technologist
Content Master
- a member of CM Group
www.contentmaster.com
"Cloudfall" <SydneyCloudfall@.hotmail.com> wrote in message
news:1132716530.406874.269410@.f14g2000cwb.googlegr oups.com...
> Is there some way of storing XML in SQL Server 2005 as "pure" XML as,
> say, an XML order per record (unshredded to extract the original data )
> and then querying the XML to get aggregate information on individual
> orders (e.g. sum of cost of all items in order) and then further
> aggregating the information to get, say, quarterly results (e.g. sum of
> cost of all items ordered from January 2005 to March 2005)? If the
> answer to this is yes, and I don't expect it to be, how is this done
> (i.e. can someone point me to information on how I could implement such
> a thing)? Believe it or not, we can only get this information in XML
> format. We would have to pay someone to design a relational database to
> take this information, write a script to unshred the data from the XML
> and populate the database tables, and then write queries to extract
> aggregate data from the database.
>
|||"Cloudfall" <SydneyCloudfall@.hotmail.com> wrote in
news:1132716530.406874.269410@.f14g2000cwb.googlegr oups.com:

> Is there some way of storing XML in SQL Server 2005 as "pure" XML as,
> say, an XML order per record (unshredded to extract the original data
> ) and then querying the XML to get aggregate information on individual
> orders (e.g. sum of cost of all items in order)
If the XML you store in a column in a row have order items nodes, then
sure no prob. You use the built-in xquery functionality on the xml
datatype to do these aggregations.

>and then further
> aggregating the information to get, say, quarterly results (e.g. sum
> of cost of all items ordered from January 2005 to March 2005)?
I assume you with this means you want to do querying/aggregation over
several rows? If so, this is not supported "out of the box", SQL Server
does not support composition on the xml data-type. However it can be
done by selecting in all the data into an xml variable and then do the
query/aggregation against that.

>If the
> answer to this is yes, and I don't expect it to be, how is this done
> (i.e. can someone point me to information on how I could implement
> such a thing)?
Read Books Online about the xml data type and XQuery.
Niels
**************************************************
* Niels Berglund
* http://staff.develop.com/nielsb
* nielsb@.no-spam.develop.com
* "A First Look at SQL Server 2005 for Developers"
* http://www.awprofessional.com/title/0321180593
**************************************************
|||Niels and Graeme, I sincerely thank you for the trouble you have gone
to in addressing my issue and pointing me in the right direction.
|||To clarify, you can do the both aggregations with methods on XML data type.
To calculate prices of all orders when an order is an XML instance with
LineItem-s as XML elements you can write something like:
SELECT
sum(
xml_order.value('sum(/Order/LineItem/@.Price)','FLOAT')
)
FROM Orders
The inner XQuery "sum" would aggregate all price attribute values in an XML
instance and the outer T-SQL "sum" will aggregate across multiple XML
instances.
Best regards,
Eugene
This posting is provided "AS IS" with no warranties, and confers no rights.
"Cloudfall" <SydneyCloudfall@.hotmail.com> wrote in message
news:1132796074.018648.122550@.o13g2000cwo.googlegr oups.com...
> Niels and Graeme, I sincerely thank you for the trouble you have gone
> to in addressing my issue and pointing me in the right direction.
>
|||Hi Eugene,
Sorry to take so long to get back to you (I had to finalise and finally
finish a VBA for Excel project I've been working on for some months and
that's done now). This is my next project.
Thank you for feedback on the nested sums in the Select statement. I
expect my next project will be to develop a(n) SQL Server 2005 database
for storing XML orders which can be queried to produce a known set of
management reports. Consequently, I expect to be a regular visitor to
this group with my newbie questions.
Thank you again for your help.
Terry R.

Can I query XML data in SQL Server 2005 and get aggregate information? If so, how?

Is there some way of storing XML in SQL Server 2005 as "pure" XML as,
say, an XML order per record (unshredded to extract the original data )
and then querying the XML to get aggregate information on individual
orders (e.g. sum of cost of all items in order) and then further
aggregating the information to get, say, quarterly results (e.g. sum of
cost of all items ordered from January 2005 to March 2005)? If the
answer to this is yes, and I don't expect it to be, how is this done
(i.e. can someone point me to information on how I could implement such
a thing)? Believe it or not, we can only get this information in XML
format. We would have to pay someone to design a relational database to
take this information, write a script to unshred the data from the XML
and populate the database tables, and then write queries to extract
aggregate data from the database.You can store the data as XML by using the new xml data type. This data
type has various methods that you can use to query the data. The methods
include some XQuery based functions to extract information from an xml
column or variable (the "query", "value", and "exist" methods), which might
help if your aggergated data also needs to be in XML format. Alternatively,
theres a "nodes" method that you can use to extract a rowset from an xml
value (or you could use OPENXML). You can even create indexes on the xml
columns to improve XQuery performance.
All of this is described in SQL Server Books Online, and
http://msdn.microsoft.com/sql/learn...ml/default.aspx is a good place to
start.
-
Cheers,
Graeme
_____________________
Graeme Malcolm
Principal Technologist
Content Master
- a member of CM Group
www.contentmaster.com
"Cloudfall" <SydneyCloudfall@.hotmail.com> wrote in message
news:1132716530.406874.269410@.f14g2000cwb.googlegroups.com...
> Is there some way of storing XML in SQL Server 2005 as "pure" XML as,
> say, an XML order per record (unshredded to extract the original data )
> and then querying the XML to get aggregate information on individual
> orders (e.g. sum of cost of all items in order) and then further
> aggregating the information to get, say, quarterly results (e.g. sum of
> cost of all items ordered from January 2005 to March 2005)? If the
> answer to this is yes, and I don't expect it to be, how is this done
> (i.e. can someone point me to information on how I could implement such
> a thing)? Believe it or not, we can only get this information in XML
> format. We would have to pay someone to design a relational database to
> take this information, write a script to unshred the data from the XML
> and populate the database tables, and then write queries to extract
> aggregate data from the database.
>|||"Cloudfall" <SydneyCloudfall@.hotmail.com> wrote in
news:1132716530.406874.269410@.f14g2000cwb.googlegroups.com:

> Is there some way of storing XML in SQL Server 2005 as "pure" XML as,
> say, an XML order per record (unshredded to extract the original data
> ) and then querying the XML to get aggregate information on individual
> orders (e.g. sum of cost of all items in order)
If the XML you store in a column in a row have order items nodes, then
sure no prob. You use the built-in xquery functionality on the xml
datatype to do these aggregations.

>and then further
> aggregating the information to get, say, quarterly results (e.g. sum
> of cost of all items ordered from January 2005 to March 2005)?
I assume you with this means you want to do querying/aggregation over
several rows? If so, this is not supported "out of the box", SQL Server
does not support composition on the xml data-type. However it can be
done by selecting in all the data into an xml variable and then do the
query/aggregation against that.

>If the
> answer to this is yes, and I don't expect it to be, how is this done
> (i.e. can someone point me to information on how I could implement
> such a thing)?
Read Books Online about the xml data type and XQuery.
Niels
****************************************
**********
* Niels Berglund
* http://staff.develop.com/nielsb
* nielsb@.no-spam.develop.com
* "A First Look at SQL Server 2005 for Developers"
* http://www.awprofessional.com/title/0321180593
****************************************
**********|||Niels and Graeme, I sincerely thank you for the trouble you have gone
to in addressing my issue and pointing me in the right direction.|||To clarify, you can do the both aggregations with methods on XML data type.
To calculate prices of all orders when an order is an XML instance with
LineItem-s as XML elements you can write something like:
SELECT
sum(
xml_order.value('sum(/Order/LineItem/@.Price)','FLOAT')
)
FROM Orders
The inner XQuery "sum" would aggregate all price attribute values in an XML
instance and the outer T-SQL "sum" will aggregate across multiple XML
instances.
Best regards,
Eugene
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Cloudfall" <SydneyCloudfall@.hotmail.com> wrote in message
news:1132796074.018648.122550@.o13g2000cwo.googlegroups.com...
> Niels and Graeme, I sincerely thank you for the trouble you have gone
> to in addressing my issue and pointing me in the right direction.
>|||Hi Eugene,
Sorry to take so long to get back to you (I had to finalise and finally
finish a VBA for Excel project I've been working on for some months and
that's done now). This is my next project.
Thank you for feedback on the nested sums in the Select statement. I
expect my next project will be to develop a(n) SQL Server 2005 database
for storing XML orders which can be queried to produce a known set of
management reports. Consequently, I expect to be a regular visitor to
this group with my newbie questions.
Thank you again for your help.
Terry R.