I have come across a user that has error 2525 errors on sysobjects tables throughout their SQL 6.5 system. The ids match and I can identify the index. But as they are system tables I cannot drop or rebuild the indexes.
Any ideas please?
The errors have been occuring for some time, so it is not an option to restore. I would like to avoid having to transfer data to and from another SQL Server.
I need to drop and recreate few subscriptions in transactional publication Do I need to worry about log marker issues ? Do I need to set the primary and replicate databases in 'DBO use only'
The Primary and Replicate databases are being accessed all the time.
I'm having a heck of a time trying to upload data to an excel spreadsheet. This works perfectly in sql 2000 but I've been having problems with 2005
SSIS package "Package1.dtsx" starting. Error: 0xC002F210 at Drop table(s) SQL Task, Execute SQL Task: Executing the query "drop table `GRE` " failed with the following error: "Table 'xxx' does not exist.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. Task failed: Drop table(s) SQL Task Error: 0xC002F210 at Preparation SQL Task, Execute SQL Task: Executing the query "CREATE TABLE `xxx` ( `TEST_REC_NBR` Decimal(29,0), `PROCESS_DT_GRE` LongText ) " failed with the following error: "Invalid precision for decimal data type.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. Task failed: Preparation SQL Task SSIS package "Package1.dtsx" finished: Failure.
Hello, I need to retrieve all the information about all the foreign key constraints,inorder to store them temporarily (to be deleted later)and then recreated after making the necessary modifications to the concerned tables. The stored proc sp_helpconstraint shows all the constraint types, their user-defined or system-supplied name, the columns on which they have been defined, and the expression that defines them.But I don't know whether it can be manipulated to get what I want.I need to get it done programmatically..so that I can integrate it in my program which I'm building up progressively. Any help or scripts would be appreciated!
Hi,I found this SQL in the news group to drop indexs in a table. I need ascript that will drop all indexes in all user tables of a givendatabase:DECLARE @indexName NVARCHAR(128)DECLARE @dropIndexSql NVARCHAR(4000)DECLARE tableIndexes CURSOR FORSELECT name FROM sysindexesWHERE id = OBJECT_ID(N'F_BI_Registration_Tracking_Summary')AND indid 0AND indid < 255AND INDEXPROPERTY(id, name, 'IsStatistics') = 0OPEN tableIndexesFETCH NEXT FROM tableIndexes INTO @indexNameWHILE @@fetch_status = 0BEGINSET @dropIndexSql = N' DROP INDEXF_BI_Registration_Tracking_Summary.' + @indexNameEXEC sp_executesql @dropIndexSqlFETCH NEXT FROM tableIndexes INTO @indexNameENDCLOSE tableIndexesDEALLOCATE tableIndexesTIARob
I have found an (encrypted) SP which takes ~20 seconds to run on one of our client DBs.
If I drop and recreate (or alter) the SP giving it the same contents it will run in ~1 second.
I need to know 1. why the sp started running so slowly 2. how to stop it happening again 3. how to fix it without resorting to drop/recreate (I can't exactly write a batch script to recreate all our sps every so often)
I have tried sp_updatestats and sp_recompile before running the sp to no avail...
I have two tables Person & Location where Location has a primary key LocationId and Person has a foreign key LocationId.
Sometime ago I used the Database Diagrams visual tool of SQL Server Management Studio Express to create the foreign key relationship between the two tables - i.e. "visually" (drawing a line between the PK & FK LocationId elements of both tables).
Time has passed and I recently noticed that, upon retrieving my saved diagram, the foreign key relationship had "fallen off" (i.e. the many-to-one line was no longer showing in the diagram).
After recreating the relationship (redrawing the line) I find that I get an error message when I try to save the diagram:
Post-Save Notifications [!] Errors were encountered during the save process. Some database objects were not saved.
'Location' table saved successfully 'Person' table - Unable to create relationship 'FK_Person_Location'. The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_Person_Location". The conflict occurred in database "mydb", table "dbo.Location", column 'LocationId'.
When I go back to the object explorer and view the dependencies for the two tables, there is no dependency (between these two tables) revealed. When I try to create the foreign key constraint manually (T-SQL) it again says can't add the constraint. It comes up with an error as follows:
ALTER TABLE Person ADD FOREIGN KEY (LocationId) REFERENCES Location (LocationId)
Msg 547, Level 16, State 0, Line 2 The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK__Person__LocationId__793DFFAF". The conflict occurred in database "mydb", table "dbo.Location", column 'LocationId'.
(Note: Each time I do this, the 8 hexadecimal character suffix changes.)
When I try to drop the foreign key:
alter table Person drop constraint FK__Person__LocationId
it comes back with the error:
Msg 3728, Level 16, State 1, Line 2 'FK__Person__LocationId' is not a constraint. Msg 3727, Level 16, State 0, Line 2 Could not drop constraint. See previous errors.
So it seems that there's some kind of goof up here. Can anybody shed light on this / tell me how to fix it?
I have a database around 500 GB. right now the database have only one data file and one log, it has only one filegroup also.all the indexes and table are placed in Primary Filegroup . we are going to separate them. the planing is to move all the indexes to Secondary filegroup and all the table will be in Primary filegroup.But there will be a problem while implementing it because there are around 600 tables and each table have at least 2 non-clustered index , so is there any way to move all the index to Secondary Filegroup.
Hi!I need to recreate the system tables (sysobjects, syscolumns,sysindexes, sysforeignkeys, sysconstraints, sysreferences, sysindexkeysat least) in another SQL server.You may say "Thats easy! Backup and restore the database!" and I wouldanswer "I can't, the database size is above 50GB and I just can't do itevery time I need to recreate the info".So, ¿Do you know any simple way to do these?I don't need the data on the user tables and I'll log-in always as dbo(using trusted connection), perhaps that helps.Perhaps the simplest way is to do a bcp to backup and restore the databut.... you never know what would happen. This is why I write ask youguy, probably you know much more than me.Thanks in advance
I have a database with many PK and FK constraints. Is there any script I can use to drop all indexes and rebuild them taking care of PK and dependencies? I am unable to drop them by tablename order. This is on MSSQLServer-2000 SP3. Any help is appreciated.
I'm trying to drop all indexes and primary keys so that i can rebuild them(from a script created from same database on another server).when i go to the 'generate sql scripts', it has the ability to drop orgenerate alltables. it also has the ability to generate all keys only. but i cant finda wayto drop all of these keys...any ideas?tiawoody rao
I ran a SP that lists fragmented tables in our DB which listed almost all the tables and indexes in the DB. The list includes index names that start with "_WA_Sys_tablecolumn name_.....". Are these SQL Server generated indexes or are these statitics on the tables? What are they? If these are system generated indexes as I thought they were, how are they generated? Can these indexes be dropped or should one want to? IF so, how? Any effect on the DB performance if dropped?
SQL SERVER 2000System let's you alter the system tables and add indexes. However, it won'tlet you drop the index afterward.Anybody know how to drop an index on a system table?Thanks,Kevin
hi, if exists (select * from sysobjects where id = object_id('dbo.MRDD_FINAL') and sysstat & 0xf = 3) drop table dbo.MRDD_FINAL
This code was generated when I used the create a script to build a table from an existing table. is there a way to check if a a table contains data or not, The whole idea is to check if table A contains data, I need to truncate the table,otherwise I do nothing... regards
We have a client that has a large (5Gb) database replicated to 13 subscribers, the publisher is Sql 2005, the subscribers are Sql Express. The publication has as few filtered articles too. I have found that after several months of continuous running Replication Monitor is taking a long time to report history on each subscriber.
Do people tend to rebuild the indexes on the system merge replication tables on production servers, or should the standard replication jobs take care of this?
I'm working to improve performance on a database I've inherited, and there are several thousand indexes. I've got a list of ones which should definitely exist within the database, and I'm looking to strip out all the others and start fresh, though this list is still quite large (1000 or so).
Is there a way I can remove all the indexes that are not in my list without too much trouble? I.e. without having to manually go through them all individually. The list is currently in a csv file.
I'm looking to either automate the removal of indexes not in the list, or possibly to generate the Create statements for the indexes on the list and simply remove all indexes and then run these statements.
As an aside, when trying to list all indexes in the database, I've found various scripts to do this, but found they all seem to produce differing results. What is the best script to list all indexes?
I need a stored procedure that can drop and recreate any table in a DB.
How could I find out all information pertinent to a table and able to generate the create statement dynamically in the preocedure then drop it and recreate the table.
I want to drop table and then recreate. It's referenced by many table and I dont want to drop all constraints referencing to it. Is there any feature like "switch off/on constraints" in MSSQL?(6.5)
Does anyone know how to recreate a database from a log file? Here is the situation:
I had a server go bad. The drive configuration was as follows
Server OS on separate RAID controller - RAID Level 1 SQL Data on separate RAID controller - RAID Level 5 Transaction Logs on Separate Raid Controller - RAID Level 1
I lost the RAID 5 array and can't get it back and don't have a backup. I need to know if/how I can recreate the database from the log file. The log file has been set to grow and has never been purged so I am hoping that I can recreate the database from scratch. Is this possible?
Dear All, after searching continuously for removing the suspect mode of MSDB database, i've found a great article in net.but i dont understand how to proceed. please explain me the steps....
1.Detach the damaged msdb. You can't just detach msdb because you're not allowed to detach system databases. However, you can if you start the server with trace flag 3608. I did this by shutting down the server, navigating to the directory 'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLBinn' and doing the following: start sqlservr.exe -c -T3608 2.Move or rename the damaged msdb files (msdbdata.mdf and msdblog.ldf in the 'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLData' directory) 3.Run the instmsdb.sql script in the 'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLInstall' directory 4.Shutdown and restart the server without the 3608 trace flag
Vinod Even you learn 1%, Learn it with 100% confidence.
I want to create a clean copy of my DB now that it is done. So it can be moved to another Server. It has some sample data in some tables that I would like to keep and some in other table that I don't. How can I do this?
Due to a server move of our SQL databases something 'strange' happend: one of the login accounts disappeared.
When I try to recreate it, SQL gives me back an error stating the account already exists. Read something about loginaccounts becoming orphaned but don't know how to solve it. The login account is a Windows (AD) account and not a SQL account (both requiring different methods of fixing?). How can I recreate just this single account?
I am trying to recreate a MySQL database on a new domain. The original database was exported into about 40 .SQL text files. I am importing these .SQL text files into a new database using phpmyadmin. When I attempt to import the first of these files, I get a "fatal error". It says the upload time has exceeded the 300 second limit. How do I set up the server so there is no upload time limit? Or how would you approach a solution to this problem? There are about 40 of these text files and each file varies in size between 5 and 15mb. Is it possible to split individual files in half or 3 parts and import that way? Any help would be greatly appreciated. Thanks!!
Can anyone help with how to recreate a pull subscription replication job after I had to recreate the msdb database when it was marked as suspect. I still have the subscription but cannot seem to recreate a pull replication job