WE have a job that loads data from an Oralce DB into our SQL Server 2000 DB twice a day. The schedule has just changed so that now there is a possibility of having my west coast users impacted when it runs at 5 PM PST and my east coast users impacted when it runs at 7 AM EST. As a workaround, I have developed a DTS package that loads the data into temp tables instead of the real tables. IE. Oracle -> XTable_temp instead of Oracle -> XTable. The load sometimes takes about an hour to an hour and a half to load, so this solution works great, but I want to then lock the table, delete it and rename the temp table to table X. The pseudo code would be:
Begin Transaction
Lock Table XTable
Drop XTable
Alter Table XTable_temp rename to XTable
Release Lock XTable
End Transaction
Create XTable_temp
I see two issues with this solution. 1) I think if I can lock XTable that the lock would be released when the table is dropped and the XTable_temp was being renamed. 2) I can't find a command to rename a table.
How to prevent a stored procedure or trigger from being invalidated after renaming a table. I used sp_rename but it does not alter the stored procs and triggers using the table ,is there any way to change all the dependent objects without manually generating the script and then changing it
Hi, I have written a service to rename table, how to check is the table is locked by another processes? There are some processes will execute select statement on it. The rename transaction must wait until all the select transactions have been finished.
Does there has a way to rename a table name in sqlce 3.5 database ? It looks like use sql alter command can not do this task . Any one could give me advice are welcome. Thanks.
i have a table called images it has over 200,00 rows - i need to add 2 new fields and could not do it. i created a new table and moved over the records but i can't delete or truncate or rename the table either
EXEC sp_rename 'images', 'imagesold' is just taking forever
i've SQL EXPRESS and want to rename the column/field of a table but it's not running. here is the query i'm using: ALTER TABLE tablename RENAME COLUMN OldName TO NewNameand it shows me the below error:Msg 156, Level 15, State 1, Line 1Incorrect syntax near the keyword 'column'. pls tell me how can i rename a field of a table.
i recorded a script for a change i need to make. actually 15 so far, i am getting ready to bring an access db with no pk or fk and only 1 relation over to ss05
my scripts are used to add the need pk fk to the tables and then move the data from the temptbl to the new one
1 thing i have been noticing is code like below will rename the table dbo.aMgmt.Employee and with that all the remaing lines of the script will fail.
DROP TABLE aMgmt.Employee GO EXECUTE sp_rename N'dbo.Tmp_Employee', N'aMgmt.Employee', 'OBJECT' GO
I need to rename a replicated table columns.will this affect my current replication (Transactional replication)? Do i have to create a new snapshot and restart the subscriber?
I am using the compact edition on a desktop using VS2005 as well as SQL Server Management Studio. None of those tools allow me to rename a column or rename a table. Can someone point me a tool the runs on the desktop (as opposed to running on a CE device) that allows me to do the renaming?
I have a long query which I have set off and would like to stop, andrename one of the tables used.My query is due to my lack of understanding of the underlyingstructure of MSSQL-Server...So say and update updates TABLE_A and I stop it, whilst thistransaction is rolling back I attempt to rename TABLE_A to TABLE_A_OLDand rename a different table to become TABLE_A. I am assuming thatthe rollback actions will use the object reference of TABLE_A_OLD andcontinue to rollback the effects on the correct table and not corrupt'new' TABLE_A... or will it not allow me to rename TABLE_A until therollback is complete?Thanks for any help!Steve
I renamed a database table, and then try to create a view with that table. However, the renamed table does not appear in view designer. I have to close and re-open SQL Server Management studio 2014.
I'm trying to rename a table with date suffix at the end of the table name, and drop the date suffix table which is greater than 7 days. for that I have the below sql, I have not included the drop syntax in this.
I'm not able to rename with the date suffix in the below sql, syntax error at '+'
DECLARE @TPartitionDate date IF EXISTS (SELECT * FROM sysobjects WHERE Name = 'IIS_4') BEGIN SELECT @TPartitionDate = MAX(PartitionDate) FROM PartitionLog (NOLOCK) EXEC sp_rename 'IIS_4','IIS_4_'+ @TPartitionDate END
If you drop / rename a table and then recreate the table with the SAME NAME, what impact does it have on stored procedures that use these tables? From a system perspective, do you have to rebuild / recompile ALL the stored procedures that use this table?
I had a discussion with someone that said that this is a good idea, since the IDs of the tables change in sysobjects and from a SQL SERVER query plan perspective, this needs to be done...
Question 2
If you Truncate a Table as part of a BEGIN TRANSACTION, what happens if an error occurs? Will it Rollback? The theory is that it won't because Truncate doesn't utilize the logs where as Delete From uses the SQL Logs?
I'm working on creating a new version of an existing table. I want to keep the old table around, only with a different name. In looking this up I found there's a system routine named sp_rename, which looks like it will work fine.However in thinking about this I realized that the foreign key constraints defined on the table (there's 3 of them) are likely to not be renamed, correct?
If I'm correct, then I suppose I could rename the table, then drop the 3 foreign key constraints, and create them new using different names for those foreign key constraints.
i am trying to set up a way of renaming a table in a sp.
ive been using
exec sp_rename 'old table', 'new table'
however if i try and specify to database and owner i end up with a weired db.owm.db.own.table name in the outcome. ive tried putting using it without specifying a db name in a sp and then sched job to exec the sp but it doesnt rename, probably because it doesn know which db to look for the ld table name in. however the sched job doesnt fail?
Hello,I have a shared hosting plan which already has aspnetdb.mdf on the server so of course I cannot use that db name for my site...I have renamed the db and now I get an error Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion My question is, how can I make this thing work? All help is greatly appreciated!
Can anybody please tell me how to rename an sql server express. I have an SQL server instance named 'PC075/Sqlexpress'. I have to change it to 'PC075'. Thanks,
if my computer name is x and sql server was installed and therefore took on the default name of x, can I change the sql server name to y at a later date while the computer name remains as x? If so how do I do it?
The sp_addserver is internal recognition. But I want to connect to sql server using the new name y. I am assuming setup needs to be run only if computer name also changes to y and this is not the case.
Is there a way to rename a object across server using the sp_rename sp. I have a job running across server and I one of the steps requires me to rename a object on a different server.
In EM, when you right click a database and go to properties you can see on the general tab the file name,the location,the space allocated in MB and the file group. Is it possible to change the file name and how you achieve it? Where are these names stored? I really appeciate any suggestions. Thank you very much! Franco
I would like to rename my SQL server. Someone suggested SQLServer and we went with it, but after some discussions with other developers we thought that this name would be a hackers delight. So now I need to rename it to something that wouldn't put a "bulls eye" on its back. Any suggestions? :-)
This machine is not in production just yet, so if I had to reinstall SQL it wouldnt' be that bad of an option.