Results 1 to 8 of 8

Thread: Stored Proc for new record in SysObjects

  1. #1

    Thread Starter
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401

    Stored Proc for new record in SysObjects

    Does anyone know if there is a system stored procedure available for inserting new rows into the sysobjects table?

    I have looked throughout the Master database but cannot find one.

    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Stored Proc for new record in SysObjects

    Why do you want to insert rows into a system table?

    Wouldn't it be better to create your tables/views using the normal methods (through the user interface, or with SQL statements)?

  3. #3

    Thread Starter
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401

    Re: Stored Proc for new record in SysObjects

    Why do you want to insert rows into a system table?
    I'm just a simple programmer and I have my orders!
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Stored Proc for new record in SysObjects

    That doesn't seem like a good idea to me... it is something that I have never seen a need for, and could cause serious issues.

    There are times when you should question your "orders", and this is one of those times.

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Stored Proc for new record in SysObjects

    I'm with si on this.... in fact, it jsut osunds down right dangerous....

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6
    Fanatic Member kaffenils's Avatar
    Join Date
    Apr 2004
    Location
    Norway
    Posts
    946

    Re: Stored Proc for new record in SysObjects

    Quote Originally Posted by stingrae
    I'm just a simple programmer and I have my orders!
    I totally agree with si_the_geek and techgnome. You should never write directly to the system tables. Use DDL (Data Definition Language, like CREATE, ALTER, DROP) and system stored procedures like sp_rename if you want to do modifications to objects.

    Tell your boss that the guys at VBForums told you not to do what he told you to do

  7. #7
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Stored Proc for new record in SysObjects

    If your goal is to add columns to tables, or alter tables - it would be much better to develop a program to create a DDL script to perform those actions.

    We have programs our mainframe systems that will create DDL scripts to "create" the entire SQL database, tables and index structure - by simply analyzing the mainframe database/table structure information.

    If your goal is to develop a program similar to ENTERPRISE MANAGER - that performs table creation and modification - then yes, there are system stored procedures to do what you are asking about. Many of them are not documented. EM most likely uses these to do much of what it does in design mode, on a table. It also creates complex scripts to move columns around - so it's not all done one way.

    For example, go into BOOKS ONLINE, and lookup SP_RENAME - this system sproc will change the name of an object in SYSOBJECTS. You can look at the "source" for this sproc in the MASTER database and even see how it does it.

    All of this is very complex - there are many relationships between the system tables. Also, it can all change from one version of MS SQL to the next.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  8. #8
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Stored Proc for new record in SysObjects

    stingrae,

    What would be the purpose for this type of operation. Sounds like he person that gives orders does not know much about what need to be done or how to accomplish it.

    There has NEVER EVER been a reason a user needed to directly access the System Tables.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width