How To Find If Index Key Is ASC Or DESC From System Tables?
Apr 29, 2003
There is a index: CustomerInfo_1
with keys: customerId, EnteryDate DESC
I could not find where the order of index key (i.e. whether the key is ascending or descending) is stored?
I tried system tables such as sysindexes and sysindexkeys tables. But could not find it.
Any help in this regard will be truly appreciated.
There is a index: CustomerInfo_1 with keys: customerId, EnteryDate DESC I could not find where the order of index key (i.e. whether the key is ascending or descending) is stored? I tried system tables such as sysindexes and sysindexkeys tables. But could not find it. Any help in this regard will be truly appreciated.
I tried all the INFORMATION_SCHEMA on SQL 2000 andI see that the system tables hold pretty much everything I aminterested in: Objects names (columns, functions, stored procedures, ...)stored procedure statements in syscomments table.My questions are:If you script your whole database everything you end up havingin the text sql scripts, are those also located in the system tables?That means i could simply read those system tables to get any informationI would normally look in the sql script files?Can i quickly generate a SQL statement of all the indexes on my database?I read many places that Microsoftsays not to modify anything in those tables and not query them since theirstructure might change in future SQL versions.Is it safe to use and rely the system tables?I basically want to do at least fetching of information i want from thesystem tables rather than the SQL script files.I also want to know if it's pretty safe for me to make changes in thesetables.Can i rename an object name for example an Index name, a Stored Procedurename?Can i add a new column in the syscolumns table for a user table?Thank you
Does anyone have a general rule or guide on when to use this SQL 2000 option when creating indexes? I was thinking generally on nonclustered indexes where the column would be unique and incremental and usually filtered on by range and often used in the order by clause. Such as columns of datetime or integers datatypes. Thanks.
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
Identity(1,1) column ID is primary key and only clustered index key.
Rows will be inserted regularly into this table, hundreds per day.
Queries will be mostly selecting on the most recent records.
In a year, the row will have half a million records or so and only the most recent records will be used. There will be a forward-rolling hot spot, of most recent records.
Does the direction of the ID column in the clustered index make a difference?
I'm thinking no, because query plan will go to that leaf in an index seek regardless of whether it is old or new, "bottom" or "top" of index, especially if the query is very specific on the ID.
Just wonder if system base tables always use clustered index? I am using SQL Server 2005 and find sys.sysidxstats base table is using heap, not clustered index. Why?
Hi All,I use Bulk insert to put data to myTable.When the SQL server is in local machin, it works well. But when I putthe data in a sql server situated not locally, then I get a errormessage like this:Could not bulk insert because file 'C:Data2003txtfilesabif_20031130.txt' could not be opened. Operating systemerror code 3(The system cannot find the path specified.).BULK INSERT myTableFROM 'C:Data2003 txtfilesabif_20031130.txt'with (-- codepage = ' + char(39) + 'ACP' + char(39) + ',fieldterminator = ';',rowterminator = '',keepnulls,maxerrors=0)Someone can explan me what the error shows upThanks in advance- Loi -
Hi,I have a few things on my databases which seem to be neither true systemobjects or user objects - notably a table called 'dtproperties' (createdby Enterprise manager as I understand, relating to relationship graphingor something) and some stored procs begining with "dt_" (some kind ofsource control stuff, possible visual studio related). These show up whenI use"exec sp_help 'databaseName'"but not in Ent. Mgr. or in Query Analyzer's object browser, and also notin a third party tool I use called AdeptSQL. I am wondering how thosetools know to differentiate between these types of quasi-system objects,and my real user data. (This is for the purpose of a customized schemagenerator I am writing). I'd prefer to determine this info with systemstored procs (ie sp_help, sp_helptex, sp_...etc) but will dip into thesystem tables if needed.Thanks,Dave
Anybody had experience dropping the system generated index?
I tried to drop some auto-generated index which usually have name like _WA_Sys_[column name}_07F6335A. Then I follow the table.index name rule. It always show no such index exists in the database. But I can query these indexes in sysindexes and verify they are there. What went wrong?
Please help 1. my database can not truncate log and I use this command BACKUP LOG IMVDB2 WITH NO_LOG and after that I received result as below ->The log was not truncated because records at the beginning of the log are pending replication. Ensure the Log Reader Agent is running or use sp_repldone to mark transactions as distributed.
2. so I drop all replicate but it's still return same error so I try to run DBCC CHECKDB --> but no error meesage DBCC CHECKALLOC --> but no error meesage DBCC CHECKTABLE ('sysindexes') --> but no error meesage but I tried to run 3. DBCC PAGE (IMVDB2, 1, 13015, 3) i recieved -->Server: Msg 2591, Level 16, State 14, Line 1 Could not find row in sysindexes with index ID 2 for table 'object ID (334220541)'. DBCC execution completed. If DBCC printed error messages, contact your system administrator.
so what can I do the next to fix this problem, please help[/b]
Greetings. Today I was testing the sql backup/restore functions on ourprimary server. I was able to backup my database without any problemsbut when I tried to restore it, I received an error "Could not find theindex entry for RID '3610200101a03cc4b49d8bbc84bac50cbe042cecf76' inindex page (1:40), index ID 0, database 'walkthrough'." Thinking thatdata had been corrupted somehow I tried another database and received asimilar error for that database. In the past, our service provider hasattempted to restore data to this server and the restore failed do toanother data corruption. The problem is, I can't find out where thecorruption is located or how to fix it.When I open the restored database in enterprise manager, it returns theabove error and is unable to get a listing of my tables. In queryanalyzer I am able to view my data but receive the index error when Iattempt to look at the information_schema data. When I try to run a DBCCCHECKDB on the corrupted database it reports 0 errors and 0inconsistencies.So my diagnosis of the problem is that something is corrupting my systemtables and that problem shows up whenever I try to restore data from abackup. There could be a hardware failure but I believe the failurewould affect more then just the sql system tables. Can anyone offer anyadvice on how to find the corruption?Thank you in advanceRichard Bailey*** Sent via Developersdex http://www.developersdex.com ***
I run dbcc checkdb on one of my databases and I get the following message....
Server: Msg 2511, Level 16, State 1, Line 0 Table Corrupt: Object ID 12, Index ID 0. Keys out of order on page (1:7364), slots 120 and 121. CHECKDB found 0 allocation errors and 1 consistency errors in table 'sysdepends' (object ID 12). CHECKDB found 0 allocation errors and 1 consistency errors in database 'DMBEN'. repair_fast is the minimum repair level for the errors found by DBCC CHECKDB (DMBEN ).
I then run dbcc checkdb ('DMBEN',repair_rebuild) with no_infomsgs and I get the same messages...nothing was fixed.
Any ideas what I can do now. I tried dropping and recreating the index but the problem is on a system database and SQL won't let me drop the index.
SQL Server 2005 has a new very useful feature for creating non-clustered indexes called INCLUDE <columns> which are very helpful when trying to create covering indexes.
Does anyone know of a way to retrieve these INCLUDE columns through any of the system metadata tables? The sp_helpIndex stored procedure is what I currently use but that only returns the (sorted) index columns and not the include columns.
Hello, I have a package that copies data FROM an MS Access database table to a SQL Server 2005 table. 'Run64BitRunTime' has been set to 'False'. The package has been saved to SQL Server. I have a Job that runs the package using an operating system command. The following is the command syntax:
€œC:Program Files (x86)Microsoft SQL Server90DTSBinndtexec.exe€? /SQL "RebatesRebates_TotalSecurity" /SERVER bwdbfin1 /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING E
I created the package on a machine other than bwdbfin1. I can run the package from Visual Studio. I can run the package from Integration Services. I have sysAdmin rights on bwdbfin1. I've tried running the job using two different proxy accounts and the sql agent account. I have the location of the Access database. No matter what I do, the Job fails with the following error:
The process could not be created for step 1 of job 0xD947EF76ACD96340B12279FEDDC580CE (reason: The system cannot find the file specified). The step failed.
I have an identical package that copies data TO an Access database. The database addressed in that package and this package are in the same location. The 'CreatorName' of both packages is the same. I have logging enabled for every category, but nothing is written to the sysdtslog90 table when the Job runs. I set up error output in the DataFlow task, and have also tried to 'ignore' errors. I have searched the forum, done a web search, and I can't find a reason for the failure.
Is dtexec the file that is not found? If that were the case, then why can a Job run my other package?
Installed SQL Server 2000 Enterprise trial a week ago on XP Pro. Installed new Seagate 80G HD; used Seagate's utility to copy old C: to new drive as new boot drive. All seems to work fine, except, when booting up, SQL server doesn't start. When I try to start it manually I get the following:
Could not start SQLSERVER service on the local computer. Error 3: the system cannot find the specified path.
I'm trying to establish the mb usage of a series of nonclustered indexes, I'm used to using the manage indexes GUI in 6.5, and showcontig doesn't quite give me what I want, any suggestions?
We're looking at optimizing some of our tables because we have indexes on columns that are not used. So for example we might have a table that has 6GB of data and 4GB in indexes (according to sp_spaceused). We need to know how much of the 4GB of indexes is consumed by each of the indexes individually. I've tried dbcc showcontig, but that doesn't tell me the amount of space used by the index that I run it for.
Second (and by far not as important), is there a way to determine how much space is being consumed by data in a specific column. The original creator of some of the tables added an incrementing identity column that is used no where in the system. I'd like to be able to say..."If we drop this column we'll save XXX in space."
Knowing the index space is more critical, the column space would be nice but not necessary.
Hi All,I have one question about many "or" operation make system chooseincorrect indexThere is one table TT (C1 VARCHAR(15) NOT NULL,C2 VARCHAR(15) NOT NULL,C3 VARCHAR(15) NOT NULL,C4 VARCHAR(15) NOT NULLC5 VARCHAR2(200),)Primary Key TT_PK (C1, C2, C3, C4)SELECT C1, C2, C3, C4 FROM TT WHERE C1 = 'TEST' AND ((C2 ='07RES' AND C3 = '00000' AND C4 = '02383') OR (C2 = '07RES' ANDC3 = '00000' AND C4 = '02382') OR (C2 = '07RES' AND C3 = '00000'AND C4 = '02381') OR (C2 = '07RES' AND C3 = '00000' AND C4 ='02380') OR (C2 = '07RES' AND C3 = '00000' AND C4 = '02379') OR(C2 = '07RES' AND C3 = '00000' AND C4 = '02378') OR (C2 = '07RES'AND C3 = '00000' AND C4 = '02377') OR (C2 = '07RES' AND C3 ='00000' AND C4 = '02376') OR (C2 = '07RES' AND C3 = '00000' ANDC4 = '02375') OR (C2 = '07RES' AND C3 = '00000' AND C4 ='02374') OR (C2 = '07RES' AND C3 = '00000' AND C4 = '02373') OR(C2 = '07RES' AND C3 = '00000' AND C4 = '02372').... about 100 or operationsOR (C2 = '07COM' AND C3 = '00000' AND C4 = '00618') OR (C2 ='07COM' AND C3 = '00000' AND C4 = '00617') OR (C2 = '07COM' ANDC3 = '00000' AND C4 = '00616') OR (C2 = '07COM' AND C3 = '00000'AND C4 = '00608') )The system choose index prefix, and query all index leaf withC1='TEST'Prefix: [dbo].[TT].C1 = 'TEST'After I reduce the OR operators to 50, it use choosePrefix: [dbo].[TT].C1, [dbo].[TT].C2,[dbo].[TT].C3,[dbo].[TT].C4='TEST, '07RES', '00000', '02383'Then Merge Join, it is very quick,Can anyone help on this, do I have to reduce the OR operator to 50?Thanks in advance!
Recently upgraded SQL Server 2005 x64 to SP2 and upto Build 3159. Since then the Maintenance Plan for Index Reorgs has failed with a System.OutOfMemoryException error. No other errors are logged anywhere. The plan report file has no information either.
Can anyone tell me a good way to monitor which indexes are not being used? Over time, I'm sure there are extraneous indexes in our database, which I would like to get rid of.
I need to find all the index and the creation date. I did cross apply of sys.objects & Sys.indexes on name column. I am getting some but the team is saying they created so many. Any other option to find Indexes and their creation date?
use tempdb go if object_id('Data', 'u') is not null drop table Data go with temp as ( select top 10000 row_number() over (order by c1.object_id) Id from sys.columns c1 cross join sys.columns c2
[code]....
What index would be best for these three queries? With best I mean the execution time, I don't care about additional space.
This is the index I currently use: create nonclustered index Ix_Data on Data (StateId, PalletId, BoxId, Id) The execution plan is SELECT (0%) - Stream Aggregate (10%) - Index Scan (90%).
Can this be optimized (maybe to use Index Seek method)?
I have a SQL Server Agent job set up to run a job that calls a dts package on the server.
When I run the DTS Package manually, everything works fine and does what it is supposed to do.
When I run the job, The job fails. If somebody had this error can you please help me out
I am getting following error in my job...
DTSRun: Loading...Error: -2147287038 (80030002); Provider Error: 0 (0) Error string: The system cannot find the file specified. Error source: Microsoft Data Transformation Services (DTS) Package Help file: sqldts.hlp Help context: 713. Process Exit Code 1. The step failed.
could you please let me know what is the possible cause for the above error.
Installed SQL Server 2000 Enterprise trial a week ago on XP Pro. Installed new Seagate 80G HD; used Seagate's utility to copy old C: to new drive as new boot drive. All seems to work fine, except, when booting up, SQL server doesn't start. When I try to start it manually I get the following:
Could not start SQLSERVER service on the local computer. Error 3: the system cannot find the specified path.
I have many databses and we are trying to see how many can be replicated. Found out 90 on't have primary keys. Next option, find unique indexed tables and convert them to PKeys. Now my question is how do I fin that a table has a unique index and column has "allow null" Please remember I am not asking to find Unique constraint.
In other words , folowing query select TABLE_NAME from INFORMATION_SCHEMA.TABLE_CONSTRAINTS where CONSTRAINT_TYPE in('UNIQUE') won't tell you if a table has a unique index.
Hi, I am working on a .dll which need to access .sdf ( sql server mobile db). In my project, I added a reference "System.Data.SqlServerCe.dll". The dll is located in C:Program FilesMicrosoft Visual Studio 8Common7IDE. I am able to compile the project. Then I created a Unit project for this dll file. In Unit project, I added the same reference. Now the magic things happen. The compiling was failed. I got "Error 1 The type 'System.Data.Common.DbConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. C:VS2005MobileDBUnitMobileDBProjectUnitMobileDB.cs 50 13 UnitMobileDBProject".
I don't understand how come the same .dll could pass in a dll project but failed in unit test project. And I never saw the System.Data.SqlServerCe display in ".Net" Section of Add reference. But in my office, I installed same version of VS2005 for software tester. I could see the System.Data.SqlServerCe display in the ".Net" section of Add Reference.