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.
:cry:
Printable View
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.
:cry:
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)?
I'm just a simple programmer and I have my orders! :(Quote:
Why do you want to insert rows into a system table?
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.
I'm with si on this.... in fact, it jsut osunds down right dangerous....
-tg
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.Quote:
Originally Posted by stingrae
Tell your boss that the guys at VBForums told you not to do what he told you to do ;)
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.
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.