table rename means a drop table and recreate?

A SQL Server Management Studio add-in to source control your database in Subversion or Team Foundation Server.

Moderators: Chris Auckland, David Atkinson, sherr, PhilScrace

table rename means a drop table and recreate?

Postby 5QL53rv3r » Thu Sep 02, 2010 3:21 pm

Hi,

I am in the process of evaluating SQL source and I have renamed a table & then went to commit the change. I noticed that SQL source wants to drop the table and the create the table with the new name. Is this how this software handles a rename?

Thanks
M
5QL53rv3r
 
Posts: 2
Joined: Thu Sep 02, 2010 3:19 pm

Postby David Atkinson » Thu Sep 02, 2010 6:07 pm

Yes, for the time being, a rename isn't treated in any special way so it is seen as a drop and the creation of a new object. Is there any reason why this would cause a problem for you?

David Atkinson
Red Gate Software
David Atkinson
 
Posts: 1124
Joined: Mon Dec 05, 2005 4:54 pm
Location: Twitter: @dtabase

Postby 5QL53rv3r » Mon Sep 06, 2010 9:36 am

will data be lost from the tables or is the data copied to temp tables and then inserted into the renamed table. so it looks like sp_rename isn't used.
5QL53rv3r
 
Posts: 2
Joined: Thu Sep 02, 2010 3:19 pm

Postby David Atkinson » Mon Sep 06, 2010 6:20 pm

Yes, if you get latest, data will be lost as we don't know that the rename has occurred. This would be a good reason to save the 'intent' of the change alongside it, and use a smart rename rather than a drop/create.

Thanks for bringing this to our attention. In the meantime, instead of using get latest for this change, you'll have to make a manual change locally with your won rename script (you can try using SQL Refactor's smart rename).

David
David Atkinson
 
Posts: 1124
Joined: Mon Dec 05, 2005 4:54 pm
Location: Twitter: @dtabase


Return to SQL Source Control 1

Who is online

Users browsing this forum: No registered users and 0 guests