sysobjects?

Posts   
 
    
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 06-Dec-2006 01:06:56   

All,

Has anyone created any kind of system for database maintenance using LLBLGen vs. the sysobjects/syscolumns tables?

I was just doing some scripting to implement audit fields on each table, and it occurred to me that it might be very easy using C#/LLBLGen code instead of writing it in SQL (it uses a lot of cursors, etc.).

Thoughts?

Phil

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 06-Dec-2006 03:19:05   

Other people may know exactly what you are talking about, but I'm a little lost flushed . What are you trying to do? Could you post an example of what you are wanting to implement instead in LLBLGen.

psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 06-Dec-2006 06:38:18   

bclubb wrote:

Other people may know exactly what you are talking about, but I'm a little lost flushed . What are you trying to do? Could you post an example of what you are wanting to implement instead in LLBLGen.

Heh. Re-reading my original post, I wasn't very clear about what I was trying to do. simple_smile

I often use SQL scripting against sysobjects and syscolumns to check whether all the tables in my database have certain columns. For example, in one project I wanted to make sure ALL tables had the following columns:

created_by_user_id created_date last_updated_by_user_id last_updated_date

Each time I created a series of new tables, I wanted an easy way to see which tables didn't have them, so I wrote scripts against the sys* tables to determine whether any of them were missing fields. I also write scripts to add the fields to the tables that didn't have them.

I can post some SQL code tomorrow (I don't have it handy) if that still doesn't make sense. simple_smile

Anyway, I was thinking about creating views of those tables and mapping them to entities. The I could use dynamic queries to do this sort of maintenance. But that's as far as my thinking has gone since I thought if it right before the end of the day today. smile

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 06-Dec-2006 07:36:46   

Anyway, I was thinking about creating views of those tables and mapping them to entities. The I could use dynamic queries to do this sort of maintenance. But that's as far as my thinking has gone since I thought if it right before the end of the day today

I'd have done it the same way.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 06-Dec-2006 09:39:40   

one shouldn't access sysobjects for this, INFORMATION_SCHEMA views are for this (which are filtered out by the sqlserver driver). Sqlserver 2005 has sys.* views for this. All filtered out by the driver. If you need them, either create a simple view which simply does a select * on these views or alter the driver sourcecode simple_smile

Frans Bouma | Lead developer LLBLGen Pro
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 06-Dec-2006 22:30:23   

Otis wrote:

one shouldn't access sysobjects for this, INFORMATION_SCHEMA views are for this (which are filtered out by the sqlserver driver). Sqlserver 2005 has sys.* views for this. All filtered out by the driver. If you need them, either create a simple view which simply does a select * on these views or alter the driver sourcecode simple_smile

Cool! I didn't know about these views. I'll tinker around with them.

Thanks,

Phil