Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Existing Schema ignored

Author  Topic 

pmack
Starting Member

1 Post

Posted - 2011-04-21 : 01:43:08
Hi,

I am using a .NET application that connects to an SQL 2005 express server and creates a database and some tables (if they do not already exist). The first time I connected, the app created the database and created the tables under the dbo schema as expected.

Then, I logged on as a different user on the same machine, I reconnected the application and it ignored the existing tables under the dbo schema and proceeded to re-create all the tables with a new schema belonging to the user.(note: the user was part of a security group on the network, which has been added to SQL Server Logins in 'Security' with sysdadmin privelages).

I have used this app on 100 different network and this is the 2nd time I have seen this behaviour. I have never been able to intentionally reproduce this behaviour.

Is it likely due to an SQL Server security feature? Or a poorly coded application?

Hope my question makes sense. Any help would be appreciated.



nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-04-21 : 07:36:58
I suspect it could be that the user already had access to the database then when added to the sysadmin group this wasn't changed and retained the old schema.
Possible due to a restore from an datbase from a previous version which has a habit of creating a schema for each user.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2011-04-21 : 09:59:26
is it not the problem that the app is creating tables and inheriting the schema from whatever user is logged on....and that inheritance is dependant on something that is not being checked in the app beforehand.

can the app be coded to search for/create tables delibrately as dbo?
Go to Top of Page
   

- Advertisement -