Hi,
I'm using "select [name] from sysobjects where OBJECTPROPERTY(id,
N'IsUserTable') = 1" to get all user-defined tables(about 17000
tables)
and found out there are tables missing in sysobjects.
How can I refresh/rebuild sysobjects table?
is there a better way to get a list of user-defined tables?
Reposted from 2000 area per suggestion. The site is running SQL 2000 build 2187.
I've got an 'accidental client' (sister company without a DBA at the moment) who has a problem that I've never seen before. They have a table that SQL claims to not exist in sysobjects. But it does exist in sysobjects as a User Table:
quote:select * from MyTable
Msg 604, Level 21, State 5, Line 1 Could not find row in sysobjects for object ID 55671246 in database 'MyTable'. Run DBCC CHECKTABLE on sysobjects.
dbcc checkdb ('MyDatabase')
Msg 2501, Level 16, State 1, Line 1 Could not find a table or object named 'MyTable'. Check sysobjects. Msg 2501, Level 16, State 1, Line 1 Could not find a table or object named 'MyTable2'. Check sysobjects. Msg 2501, Level 16, State 1, Line 1 Could not find a table or object named 'MyTable3'. Check sysobjects. Msg 2501, Level 16, State 1, Line 1 Could not find a table or object named 'MyTable4'. Check sysobjects. Msg 2501, Level 16, State 1, Line 1 Could not find a table or object named 'MyTable5'. Check sysobjects. DBCC results for 'routingengine_historical'. DBCC results for 'sysobjects'. There are 483 rows in 14 pages for object 'sysobjects'. DBCC results for 'sysindexes'. There are 310 rows in 21 pages for object 'sysindexes'. DBCC results for 'syscolumns'. There are 839 rows in 20 pages for object 'syscolumns'. DBCC results for 'systypes'. There are 26 rows in 1 pages for object 'systypes'. DBCC results for 'syscomments'. There are 470 rows in 35 pages for object 'syscomments'. DBCC results for 'sysfiles1'. There are 3 rows in 1 pages for object 'sysfiles1'. DBCC results for 'syspermissions'. There are 145 rows in 1 pages for object 'syspermissions'. DBCC results for 'sysusers'. There are 19 rows in 1 pages for object 'sysusers'. DBCC results for 'sysproperties'. There are 0 rows in 0 pages for object 'sysproperties'. DBCC results for 'sysdepends'. There are 421 rows in 4 pages for object 'sysdepends'. DBCC results for 'sysreferences'. There are 4 rows in 1 pages for object 'sysreferences'. DBCC results for 'sysfulltextcatalogs'. There are 0 rows in 0 pages for object 'sysfulltextcatalogs'. DBCC results for 'sysfulltextnotify'. There are 0 rows in 0 pages for object 'sysfulltextnotify'. DBCC results for 'sysfilegroups'. There are 1 rows in 1 pages for object 'sysfilegroups'. CHECKDB found 0 allocation errors and 0 consistency errors in database 'MyDatabase'. DBCC execution completed. If DBCC printed error messages, contact your system administrator.
dbcc checktable ('MyTable') with ALL_ERRORMSGS
Msg 2501, Level 16, State 1, Line 1 Could not find a table or object named 'MyTable'. Check sysobjects.
dbcc checktable ('sysobjects') with ALL_ERRORMSGS
DBCC results for 'sysobjects'. There are 483 rows in 14 pages for object 'sysobjects'. DBCC execution completed. If DBCC printed error messages, contact your system administrator.
I've fully verified the correct existence of the table and how it links to the object ID by running statements like:
quote:select * from sysobjects where name = 'MyTable' and type = 'U' select object_id('MyTable') select object_name(55671246)
Odd that when selecting data from the table the error refers to the database by the table name. Running checktable on sysobjects shows no errors.
Running sp_help 'MyTable' works and shows the expected results as far as columns, indexes, and such. The table structure is fully visible in Management Studio and can be visually explored. Only when querying data is there an issue.
All tables are owned by dbo.
Ideally I need to recover these tables. If that is impossible, I'd like to remove the tables and cleanly free up all the related data pages.
I detached db from SQL 2000 and attached it to a SQL 2005. However only 5 of the 10 tables showed up. Any reason for that. Anybody has seen this before? I even backed up db on 2000 and restored on 2005 and still the same number of tables showed up. BTW, the db belongs to a GFI application.
I have a database that I have been working on that is on a remote server for a website. I recently had them back up the database so I can work on it locally. After some time I managed to get the backup working, well sorta.
Originally the database was a access 2000 database. This soon proved not to be up to the task. The server people converted the database to sql 2000 and everything is working on the site. However my backup has a problem. In the manager I can see all the tables that were there before. But when I go to run a query on the database through CF the only tables that it can see are tables that were created after the access conversion. I have gone in and checked permissions and set every table and every column to public and still cannot see the missing tables. Any help?
Good day. I am a non-programmer but one tasked to "check" on the recent error in our company's systems.
In summary, most, if not all Tables were deleted from the different databases. Add to that, the logs prior to the event were also lost or deleted. Yes we do have back ups but restoring wasn't that simple. Another domain server was corrupted causing further delays in the restoration.
This is the second time it has happened and the events were 31 days apart. We would like to identify the causes for our preventive actions. Is there a hardware/software problem that may have caused these? Of course, we would like to rule out that it was done intentionally... but if you guys think otherwise, i'd like to further ask how we can validate the theory.
We are trying to find out the difference between tables in CUSTOMER database and CUSTOMER_coded database. The goal is to find out if there are any columns missing in each table of CUSTOMER_coded database.
We need the list of tables in CUSTOMER_coded database that misses some column compare to its peer in CUSTOMER database (list of columns being missing also).
I googled, but I get only all the columns in tables of database.
I need missing columns of all the tables when we compare these 2 databases( CUSTOMER and CUSTOMER_coded databases).
Hello. You can compile a proc with a non-existant table. proc compiles do fail though on exsiting tables with non-existing columns.
Anyways, question is, how can you scan thru all procedure code to find tables that do not exist in the database? Is there any new DM feature that provides this info? Meaning, if I have a proc and inside it, refer to a table name that does not exist, I want to know the proc will not execute clean. Can the deferred name resolution be turned off somehow?
Im wondering if it is possible to write a procedure that check two identical tables for any missing records. The table design is excatly the same, but some records (of the 40,000) have not copied over to the second table.
I recently moved the db to a new server using detach and reattach sproc. However the moved db in its new location does not have any of the tables or sprocs that I created. As I understand it, information on the databases on the server is stored in the master db. Could it be that the tables are not showing up because the master db on the new server knows nothing of the new db? Must I also copy the master from the other server, perhaps? Has anybody come across this before? TIA D. Lewis
I have two tables of book information. One that has descriptions of thebook in it, and the isbn, and the other that has the book title,inventory data, prices, the isbn.Because of some techncal constraints I won't get into now, I can'tcombine them both into one table. No problem. Things are going fine aslong as there is a description in the one table to corrispond to theisbn and other data in the other table.However, about half of the products are not yet entered into thedescrition table. I'd like to run a sql query that pulls up all theisbns that don't exist in the other. In other words, I'd like to get aquery that tells me exactly which isbns do not yet have descrition datain them. I know there is some sql that says to search from one filewhere the number does not exist in the other, but it slips my mind. Cansomeone help me on this please?Thank you!Bill*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
I have several databases set up for transactional replication to another instance of SQL Server 2005 for fail over purposes. Today, I restored one of those replicated databases to my development machine and discovered two surprising problems:
1) The Default Values settings in the replicated tables are missing. They are there in the publishing tables, just as they were before I set up replication. However, they are not in the subscribing tables. Now, this is not such a big issue, since I tend to send all default values in insert queries as necessary.
2) The second problem is a more of an issue, since I use auto-numbered Identity columns in my tables (yes, I know that's just plain lazy...). Anyway, in the replicated tables, €œIs Identity€? is indeed set to yes, but despite that fact that there are thousands of records with incrementally unique IDs, SQL server is trying to insert a record starting with 1. This, of course, throws a PK constraint error.
Obviously, if I am use them for failover purposes, these replicated databases need to be identical in every way.
So, what did I do to cause this situation, and how to I fix it?
I have received some data out of a relational database that is incomplete and I need to find where the holes are. Essentially, I have three tables. One table has a primary key of PID. The other two tables have PID as a foreign key. Each table should have at least one instance of every available PID.
I need to find out which ones are in the second and third table that do not show up in the first one, which ones are in the first and third but not in the second, and which ones are in the first and second but not in the third.
I've come up with quite a few ways of working it but they all involve multiple union statements (or dumping to temp tables) that are joining back to the original tables and then unioning and sorting the results. It just seems like there should be a clean elegant way to do this.
Here is an example:
create table TBL1(PID int, info1 varchar(10) )
Create table TBL2(TID int,PID int)
Create table TBL3(XID int,PID int)
insert into TBL1
select '1','Someone' union all
select '2','Will ' union all
select '4','Have' union all
select '7','An' union all
select '8','Answer' union all
select '9','ForMe'
insert into TBL2
select '1','1' union all
select '2','1' union all
select '3','8' union all
select '4','2' union all
select '5','3' union all
select '6','3' union all
select '7','5' union all
select '8','9'
insert into TBL3
select '1','10' union all
select '2','10' union all
select '3','8' union all
select '4','6' union all
select '5','7' union all
select '6','3' union all
select '7','5' union all
select '8','9'
I need to find the PID and the table it is missing from. So the results should look like:
Two of my databases are still listed under the "Database" folder in SQL Express, yet all objects are now gone. Tried detach/attach and says it works OK - yet no tables, etc.
The odd thing is that I CAN access the tables from Visual C++ Express, and all looks well (data, etc).
When I look at Properties for one of the DBs, and then click on "View Connection Properties" under the "Options" section, the error message pops up:
"Cannot show requested dialog.---------------------------- ADDITIONAL INFORMATION:
Could not load file or assembly 'file:///C:Program FilesMicrosoft SQL Server90ToolsBinnVSShellCommon7IDESqlManagerUi.dll' or one of its dependencies. The system cannot find the file specified. (mscorlib) ".
Also still throwing an error upon startup, "Unhandled exception has occurred in a component in your application. If you click continue the application will ignore this error...Cannot create a stable subkey under a volatile parent"
Clues?
Thanks
S
PS It would help to enable right click Copy and Paste in this forum -
I have a sql sever 2005 express table with an automatically incremented primary key field. I use a Detailsview to insert new records and on the Detailsview itemInserted event, i send out automated notification emails. I then received two automated emails(indicating two records have been inserted) but looking at the database, the records are not there. Whats confusing me is that even the tables primary key field had been incremented by two, an indication that indeed the two records should actually be in table. Recovering these records is not abig deal because i can re-enter them but iam wondering what the possible cause is. How come the id field was even incremented and the records are not there yet iam 100% sure no one deleted them. Its only me who can delete a record. And then how come i insert new records now and they are all there in the database but now with two id numbers for those missing records skipped. Its not crucial data but for my learning, i feel i deserve understanding why it happened because next time, it might be costly.
I am not aboe to view the userdefined tables in sql 2005. not sure whether my user dont have permission to view. how to view my user permission or not ..
another one , is there any table to find system table instead sysobjects,information_schema in 2000.
I would very much like to create a trigger on the sysobjects table in my database. When I attempt to do so, I get a permission error. Is there some way I can change the permission setting to allow me to do this?
HI there , i have recently upgraded my publishers to 2005.
Transactional replciation seems to be running fine.
However in SS2000 i always used to query sysobjects on replinfo to see if a table was replicaed and how it was replicated, 1 = snapshot , 3 = transactional etc.
However after upgrading replinfo on sysobjects is 0 for all my articles, whats up with this ?
Must i use sp_helparticle only now? Also how does the system know if an object is replicated now , i used to think it used the replinfo column on sysobjects, how is this different in 2005?
Hi all, I have a question about accessing a specific column from the database. I know when we use: select name from sysobjects would select all the table names and the constraints from the database. I want to select all the column names in each of the table. How can I go about doing this. Thank you
Once in a while, I find down there are some missing objects in production database. Because we share the sa password with couple of developers, therefore, it's hard find down who did it. So, I try to create a trigger in sysobjects table to prevent this problem, however, I keep getting the error message "error 229: create trigger permission denied on object 'sysobjects'" although I log in using sa. Can someone give me some suggestions how to prevent this from happening beside using trace profiler and also why do I get the denied message when create trigger on sysobject even with sa login.
First of all, I tried to attach my *.mdf file to SQL 2000. but It was not only failed but also SQL 2005 failed to recover my *mdf file.
Now, I think my *.MDF file has system tables for SQL 2005 because when trying to attach *.mdf to SQL 2000 engine send the following message :
-------------------------------------------------------------------------- Msg 906, Level 22, State 2, Line 1 Could not locate row in sysobjects for system catalog 'Sysobjects' in database 'rudol.net'. This system catalog should exist in all databases. Run DBCC CHECKTABLE on sysobjects in this database. --------------------------------------------------------------------------
Also, I tried again to attach the *.mdf to SQL 2005 but SQL 2005 doesn't really works.
Stupidly, I didn't back up the *.mdf file.
How do I attach it to SQL 2005 or recovery "sysobjects" table for SQL 2000? Please answer.
P.S. Forgive my terrible English. English is not my mother tongue.
i have deleted the 'sysobjects' table by accident. then follows the problem. 1. default value constraint not working 2. auto increment constraint not working
is that because of this sysobjects problem. help me out to fix this problem...
Is there a reference to describe the relevance of the Category column in the sysobjects table? I'm trying to track down stored procedures that are set to automatically run at startup and the only thing I can find that is consistent about those that are set to autorun is that they have a value of 16 in the Category column. Is this consistent? What else may I glean from this column?
Not sure how I did this, but I dropped a table and it still shows up in sysobjects. This breaks a job that rebuilds indexes because the table doesn't exist. I tried recreating and dropping the table, but the extra entry is still there. Would it be okay to just delete the row from sysobjects? This has happened in a 2000 and 2005 db at the same time.
Hi,I'm trying to determine with my program whether or not a given databasesupports a given feature set. To do this I'm querying for certain storedprocedures in the sysobjects table and if they are present, making theassumption the database will support the given feature. The problem is Ican't find a certain stored procedure in the sysobjects table, even though Iknow it exists and can see other similar procedures using:select * from dbo.sysobjects order by nameIts as if all of my other stored procedures are in the sysobjects tableexcept this one, the one I'm specifically querying for. Are there certainreasons why a proc won't appear in the sysobjects table? Is this somethingI need to fix?Thanks,Robin
Could anyone, please, explain to me why I have negative values inRowModCtr column in sysobjects table? I have tested that after I updatestatistics the RowModCtr column is reset to 0. But why do I havenegative values in the first place? Thx.