473,545 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stored Procedure does not appear in the sysobjects table.

Hi,

I'm trying to determine with my program whether or not a given database
supports a given feature set. To do this I'm querying for certain stored
procedures in the sysobjects table and if they are present, making the
assumption the database will support the given feature. The problem is I
can't find a certain stored procedure in the sysobjects table, even though I
know it exists and can see other similar procedures using:

select * from dbo.sysobjects order by name

Its as if all of my other stored procedures are in the sysobjects table
except this one, the one I'm specifically querying for. Are there certain
reasons why a proc won't appear in the sysobjects table? Is this something
I need to fix?

Thanks,

Robin
Jul 23 '05 #1
4 4951

"Robin Tucker" <id************ *************@r eallyidont.com> wrote in
message news:cs******** ***********@new s.demon.co.uk.. .
Hi,

I'm trying to determine with my program whether or not a given database
supports a given feature set. To do this I'm querying for certain stored
procedures in the sysobjects table and if they are present, making the
assumption the database will support the given feature. The problem is I
can't find a certain stored procedure in the sysobjects table, even though
I know it exists and can see other similar procedures using:

select * from dbo.sysobjects order by name

Its as if all of my other stored procedures are in the sysobjects table
except this one, the one I'm specifically querying for. Are there certain
reasons why a proc won't appear in the sysobjects table? Is this
something I need to fix?

Thanks,

Robin


Every object should be in sysobjects - if the proc isn't, then how do you
know it really does exist (you might need to refresh EM or the QA object
browser if that's where you're seeing it)? Is it a user proc or a system
proc (in which case it could be in msdb)? Can you execute it? Does
OBJECT_ID() return an ID for it? Does sp_helptext return the proc text?

You can run DBCC CHECKDB to check for any database integrity problems, and
if you have several very similar databases, don't forget to check you're
querying the correct sysobjects table.

Simon
Jul 23 '05 #2
Robin Tucker (id************ *************@r eallyidont.com) writes:
I'm trying to determine with my program whether or not a given database
supports a given feature set. To do this I'm querying for certain
stored procedures in the sysobjects table and if they are present,
making the assumption the database will support the given feature. The
problem is I can't find a certain stored procedure in the sysobjects
table, even though I know it exists and can see other similar procedures
using:

select * from dbo.sysobjects order by name

Its as if all of my other stored procedures are in the sysobjects table
except this one, the one I'm specifically querying for. Are there
certain reasons why a proc won't appear in the sysobjects table? Is
this something I need to fix?


Sounds like there is some mishap with owner. Or a surprising character
somewhere. i and í are not too easy to discern.

The best way to check whether a stored procedure exists is with

IF object_id('your procedure', 'P') IS NOT NULL

While querying system tables and INFORMATION_SCH EMA is good for admin
and maintenance stuff, I think one should be wary of doing in application
code.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #3
Hmmmm. Ok, it was a user error (I was querying the wrong database). On the
other point, about being wary of querying system tables in an application,
is there anything imparticular I should be wary of? The way I see it, there
are two methods of determining if any given database (1) supports my
application and (2) supports the current version of my application.
Firstly, I could just execute the "abcd_GetVersio n" stored procedure. I
will get an exception if it fails, ergo: not a database my software can use.
Once I have established abcd_GetVersion can be executed, I can just execute
it to find the database version and everyone is happy. The second way is
to query the system tables for objects I know are unique to my schema/object
set (ie. looking for a specific stored procedure).

Now the issue I have is that I'm enumerating servers in a combo box on a
form and I have a checkbox which states "only show servers hosting a
compatible database". Actually attempting to connect, run the stored
procedure and fail on exception is an amazingly slow way of doing this.
Much simpler I think, to just check the sysobjects table to see if the given
stored procedure I need is there.

So heres what I would like to do: connect to the server. If the connection
fails, then I am not a compatible server (for whatever reason). Once
connected: query something, somewhere to find out if the server hosts a
certain kind of database. Will I have enumerate the entire list of
databases and check each one individually?

"Erland Sommarskog" <es****@sommars kog.se> wrote in message
news:Xn******** **************@ 127.0.0.1...
Robin Tucker (id************ *************@r eallyidont.com) writes:
I'm trying to determine with my program whether or not a given database
supports a given feature set. To do this I'm querying for certain
stored procedures in the sysobjects table and if they are present,
making the assumption the database will support the given feature. The
problem is I can't find a certain stored procedure in the sysobjects
table, even though I know it exists and can see other similar procedures
using:

select * from dbo.sysobjects order by name

Its as if all of my other stored procedures are in the sysobjects table
except this one, the one I'm specifically querying for. Are there
certain reasons why a proc won't appear in the sysobjects table? Is
this something I need to fix?


Sounds like there is some mishap with owner. Or a surprising character
somewhere. i and í are not too easy to discern.

The best way to check whether a stored procedure exists is with

IF object_id('your procedure', 'P') IS NOT NULL

While querying system tables and INFORMATION_SCH EMA is good for admin
and maintenance stuff, I think one should be wary of doing in application
code.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Jul 23 '05 #4
Robin Tucker (id************ *************@r eallyidont.com) writes:
Hmmmm. Ok, it was a user error (I was querying the wrong database). On
the other point, about being wary of querying system tables in an
application, is there anything imparticular I should be wary of? The
way I see it, there are two methods of determining if any given database
(1) supports my application and (2) supports the current version of my
application. Firstly, I could just execute the "abcd_GetVersio n" stored
procedure. I will get an exception if it fails, ergo: not a database my
software can use. Once I have established abcd_GetVersion can be
executed, I can just execute it to find the database version and
everyone is happy. The second way is to query the system tables for
objects I know are unique to my schema/object set (ie. looking for a
specific stored procedure).
The third way is to have a table which lists all components that
are installed in the database.

Admittedly, sometimes there is reason to query metadata in an app,
but the less you do it the better.

Beware that in SQL 2005 there is an important change. First of all the
current system tables becomes "compatibil ity views" that are built
on top of the new "catalog views". But as long as you query documented
columns only, this is not too much of a hassle.

More important is that in SQL 2005 the metadata is not public information
in the same way as it is in SQL 2000. In SQL 2000 if you have access to
a database, you have access to all data in the system tables. In SQL 2005
you can only see metadata for objects that you have some sort of permission
to.

Since users typically have access to stored procedures that would not
be much of a problem. But assume that you have a stored procedure that
queries systemt tables to get information about tables and columns
that the users does not have permission to. This access will fail in
SQL 2005, because ownership chaining does not apply. There is a new
permission VIEW_DEFINITION to resolve this, but it can cause some
headache before you get there.
Now the issue I have is that I'm enumerating servers in a combo box on a
form and I have a checkbox which states "only show servers hosting a
compatible database". Actually attempting to connect, run the stored
procedure and fail on exception is an amazingly slow way of doing this.
Much simpler I think, to just check the sysobjects table to see if the
given stored procedure I need is there.

So heres what I would like to do: connect to the server. If the
connection fails, then I am not a compatible server (for whatever
reason). Once connected: query something, somewhere to find out if the
server hosts a certain kind of database. Will I have enumerate the
entire list of databases and check each one individually?


Yes. And since you could find a server with thousands of databases,
this is a dead end.

If you want this, I would suggest that you have a "master" server with
known server/databases and serve those to the user. Or just store
the server/database that the user have used in the registry, and then
permit him to big any server/database he wants as an alternative, and
if he makes a bad pick just say "Sorry...".
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9314
by: aaapaul | last post by:
Hallo ! I have a Table with a column "ordernumber" ordernumber A12 A45 A77 A88
4
6226
by: deprins | last post by:
Hello, I have wrote a stored procedure but its real slow. Its activated by a button on web page but its takes to long to process and the web server gives a timeout message after 5 minutes. Is there anyway to speed up this stored procedure? What am I doing wrong here? ...
17
2179
by: serge | last post by:
How can i delete all user stored procedures and all table triggers very fast in a single database? Thank you
0
2504
by: James Hokes | last post by:
Hi All, We're using the 1.1. Framework against SQL Server 2000, and are having a strange issue where we don't get errors back from the stored procedure, i.e. the exception never gets thrown. The scenario is this: 1.) Set up SqlConnection and SqlCommand 2.) Set SqlDataReader equal to the return value from SqlCommand.ExecuteReader
2
5108
by: xAvailx | last post by:
I have a requirement that requires detection of rows deleted/updated by other processes. My business objects call stored procedures to create, read, update, delete data in a SQL Server 2000 data store. I've done a fair amount of research on concurrency handling in newsgroups and other resources. Below is what I've come up as a standard for...
5
4270
by: marcsirois | last post by:
I am maintaining an application where most of the business rules are in Triggers, Stored Procedures and User Defined Functions. When a bug arises, it can get very tedious to debug. Today for example, I wanted to modify a function that was being called by a trigger. The problem is that I don't want to change the function, for fear that it is...
5
4104
by: zseifts | last post by:
Hi everyone. I am fairly new to using stored procedures but for the past few days I've been reading up on them and I need to do the following: Get all the table names from the sysobjects table Take all of those names and use them as the table name in the SELECT command Process each table individually. I also need to be able to either...
4
1853
by: davinski | last post by:
Hello, it's been a while since my last post, hope everyone is fine :P I'm stuck with what seems to be a simple task, but I'm getting confused on how to complete this. Basically, I have been given a stored procedure which nests itself within itself and uses a temporary table to store the data while writing. The nested stored procedure is...
4
13125
by: gamaz | last post by:
Hi, I am trying to work on a stored procedure that will work with multiple database. I have a prototype of multiple databases. Those are named as the following: ts2_aldkm_app, ts2_aldkp_app, ts2_aldkt_app. The middle part of the database name corresponds to the site name e.g aldkm corresponds to site aldkm etc. Each database has one table...
0
7479
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7669
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7926
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7439
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5343
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4962
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1901
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.