Showing posts with label linked. Show all posts
Showing posts with label linked. Show all posts

Wednesday, March 21, 2012

Rename a linked server

I have an app that has some stored procedures running queries across a linked server. In our development environment, the linked database is on a box called 10.xxx.xxx.xx. In the production environment, the linked database will be on a server called something else. What I want to do is have the linked server in the development environment named the same thing as the linked server in the production environment, so that I won't have to change the stored procedures when migrating the project into production.

SQL Server 2005 isn't giving me the option to rename or alias the linked server, though. Is there anyway to do this so that I can have the linked server named the same thing on the two different boxes and not have to change the sp's?

I don't think you can rename linked servers, but you can create them correctly for your needs. Don't select SQL Server, but do select the SQL native client, or just use T-SQL which may make more sense if trying to standardise stuff accross machines anyway

EXEC sp_addlinkedserver @.server= 'FRED1' ,@.provider='SQLNCLI' ,@.datasrc='10.1.1.1' ,@.srvproduct = 'SQL'

In future please try and pick a more appropriate forum. This is really SQL Server question issue, not SSIS.

sql

Rename a linked report

I can find two ways of doing this.

1.SetProperties()

Property[] props = new Property[1];
Property setProp = new Property();
setProp.Name = "Name";
setProp.Value = "NewName";
props[0] = setProp;

rs.SetProperties(itemPath, props);

> Does this also rename the 'Path' property, becuase this is our key to accessing the reports.

2. MoveItem()
string currentPath = "/Reports/OldName";
string targetPath = "/Reports/NewName";
rs.MoveItem(currentPath, targetPath);

Which should i use and why.. thanks..

Hello dreadjr or other in the forums,

I know your post was a few months back, but were you able to figure out the best way to rename a report?

I'm having a similar problem. I have a report that has linked reports linked to it, and I'm trying to rename the "main" report so that the linked reports stay linked to the newly renamed report.

I tried the MoveItem and it appear to not work correctly. The "main" report was renamed but the linked reports seemed to lose their links to the "main" report. I'll try the other method you mentioned.

Any help is appreciated.

Thanks.

|||

Hello All,

Well, I tried changing the Name using the SetProperties method. This doesn't work. An exception is throw because the Name property is read-only. Apparently, you cannot change this programmatically using SetProperties.

Anyway, any help? Again, I'm trying to rename a report that has other linked reports linked to it, while keeping the link in place so that, after the name change, the linked reports are linked to the report with the new name. This appears to work in Report Manager, but I need to make it work in a custom application.

Thanks!

Rename a linked report

I can find two ways of doing this.

1.SetProperties()

Property[] props = new Property[1];
Property setProp = new Property();
setProp.Name = "Name";
setProp.Value = "NewName";
props[0] = setProp;

rs.SetProperties(itemPath, props);

> Does this also rename the 'Path' property, becuase this is our key to accessing the reports.

2. MoveItem()
string currentPath = "/Reports/OldName";
string targetPath = "/Reports/NewName";
rs.MoveItem(currentPath, targetPath);

Which should i use and why.. thanks..

Hello dreadjr or other in the forums,

I know your post was a few months back, but were you able to figure out the best way to rename a report?

I'm having a similar problem. I have a report that has linked reports linked to it, and I'm trying to rename the "main" report so that the linked reports stay linked to the newly renamed report.

I tried the MoveItem and it appear to not work correctly. The "main" report was renamed but the linked reports seemed to lose their links to the "main" report. I'll try the other method you mentioned.

Any help is appreciated.

Thanks.

|||

Hello All,

Well, I tried changing the Name using the SetProperties method. This doesn't work. An exception is throw because the Name property is read-only. Apparently, you cannot change this programmatically using SetProperties.

Anyway, any help? Again, I'm trying to rename a report that has other linked reports linked to it, while keeping the link in place so that, after the name change, the linked reports are linked to the report with the new name. This appears to work in Report Manager, but I need to make it work in a custom application.

Thanks!