473,592 Members | 2,921 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 4959

"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
9320
by: aaapaul | last post by:
Hallo ! I have a Table with a column "ordernumber" ordernumber A12 A45 A77 A88
4
6229
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
2188
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
2509
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
5111
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 handling concurrency thru stored procedures. I am sharing with everyone so I can get some comments...
5
4276
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 being called by one of the other SP's or triggers in the database (there are hundreds of them) ...
5
4106
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 output a view or have the stored procedure output all the rows that it has processed.
4
1854
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 used so that it can output the data rows in a db table into an organized tree like Example 1 1.0...
4
13128
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 tblCustomer which is scripted as follows: if exists (select * from dbo.sysobjects where id =...
0
7871
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8236
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8366
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7995
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
5735
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5400
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3851
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3893
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1467
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.