sougatamondal / migratordotnet

Automatically exported from code.google.com/p/migratordotnet
0 stars 0 forks source link

Database RenameTable mishandling schema name #42

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Database.RenameTable("[CCO].T_Incidents", "[CCO].T_Events");
2.
3.

What is the expected output? What do you see instead?
The expected output is the table being renamed. The actual result is an
exception caused due to the existence of '.'

What version of the product are you using? On what operating system? With
what .NET implementation/version?
.Net 2.0 on Windows XP

What database and version are you seeing this issue on?
SQL Server 2005

Please provide any additional information below.
When trying to Rename a table using the Migrator, due to the schema name,
the ReNameTable method is failing with an exception.

Original issue reported on code.google.com by srikanth...@gmail.com on 2 Jul 2008 at 4:55

GoogleCodeExporter commented 8 years ago
Can you omit the schema name and see if that resolves the problem. You 
shouldn't 
include the name of the schema as this is provided via the configuration when 
you 
run the migration. ie.:

Database.RenameTable("T_Incidents", "T_Events");

Original comment by dko...@gmail.com on 2 Jul 2008 at 5:52

GoogleCodeExporter commented 8 years ago
I use multiple schemas and the same db is being used by similar but different
applicatons, so I have to specify the schema.

Original comment by srikanth...@gmail.com on 2 Jul 2008 at 8:01

GoogleCodeExporter commented 8 years ago
I have done a little research and the sql 2005 BOL states to not use the 
schema/owner name when renaming a table when using sp_rename which is what 
migrator 
is using to rename the sql 2005 tables.

Can you note how you would perform this operation with a sql query and I can 
apply 
it to the SqlTransformationProvider

Original comment by dko...@gmail.com on 3 Jul 2008 at 1:17

GoogleCodeExporter commented 8 years ago
I have used Database.ExecuteNonQuery("exec sp_rename [cco].T_Incidents,
T_callout_events");

This query runs perfectly, the trick (or quirk) here is that the new name does 
not
have the schema, since it would inferred from the old name.

Hope this helps.

Original comment by srikanth...@gmail.com on 3 Jul 2008 at 3:17

GoogleCodeExporter commented 8 years ago
I think this is a limitation of the sp_rename stored procedure that SQL Server 
uses
for renaming things. Can this be confirmed?

We've had other issues with sp_rename like it not working with ROWGUIDCOL 
columns. Is
there another way to rename things in SQL Server?

Original comment by geoffl...@gmail.com on 5 Aug 2008 at 10:19

GoogleCodeExporter commented 8 years ago
Issue #45

Original comment by geoffl...@gmail.com on 9 Feb 2009 at 11:15