Schema Compare Is Dropping User Membership By Itself

Jul 8, 2015

I just recently updated to SSDT 12.0.50512.0 using Visual Studio 2013 Ultimate. I typically use SSDT Schema Compare to synchronize my schema across multiple databases and different environments. After updating i encountered a major bug while updating our production schema.Typically during schema compare, the compare will prompt me to drop users and user roles from the database as they are not present in the project. I will exclude these so they database users and their roles aren't affected. After the update to SSDT I noticed that schema compare was only prompting me to drop the User, but didn't show anything about the user's roles. Not thinking much of it I went through my usual task of updating all the production databases. I soon found out that this did in fact remove the user roles even though it showed NOTHING in the schema compare UI indicating it would do so.

GO
PRINT N'Dropping <unnamed>...';

GO
EXECUTE sp_droprolemember @rolename = N'db_datareader', @membername = N'dbuser';

GO
PRINT N'Dropping <unnamed>...';

GO
EXECUTE sp_droprolemember @rolename = N'db_datawriter', @membername = N'dbuser';

You could say this is partially my fault for not checking the generated script before running it, but after months of this routine task I've never had an issue until this update.i'm not seeing the changes that will happen to my user roles in the schema compare UI? 

View 2 Replies


ADVERTISEMENT

How To Refresh Linq-To-SQL Classes After Schema Changes Without Dropping And Adding

May 28, 2008

All --
Please help. 
I need to know how to refresh Linq-To-SQL classes after schema changes without dropping and adding them.
Now, when I make a schema change (such as add or delete a column to a table), I want to "refresh" the Context.dbml file.
The only way that seems to work is to drop the table from the Context.dbml designer and then add it back in.
Is there a better way to do this?
How are others doing this?
Please advise.
Thank you.
-- Mark Kamoski

View 5 Replies View Related

Compare Schema's...XSD

Jul 20, 2005

Hey all,I am currently researching ways to compare databases via an XSD schema.I wrote a small app that creates a dataset from a database and exportsthat dataset to XSD. This gives me an XSD file with tables andrelationships representing the entire database.At this point, I am trying to find ways to compare these schemas. Doesanybody know of a way to do this easily and to record differences ifthere are any?Also, any information on comparing databases using any method would begreatly appreciated.Thanks,--Shock

View 3 Replies View Related

Schema And SP Compare Recommendations

Dec 3, 1999

I've searched quite a bit, and have found several leads on schema, stored procedure, and database contents comparison scripts and tools.

I'm now looking for recommendations on which ones are best, easiest:

ObjCompare.exe
sb_ABCompareDb.sql
sp_db_comp.sql

There's a mythical script from Andrew Z <mumble> that Mike Hotek talks about...

There's a DBCompare on the Back Office Resource Kit 2 CD, which of course is not in the umpteen MSDN CDs :-(

There's some *other* command line dbcompare, or maybe db_compare.

There's a DBA Compare.

I need to be able to compare divergent schemas from two developers to integrate their changes, so need schema and stored procedures compared only, and would also like to have something to compare staging servers and production servers.

Leads on other choices also welcome. I'd be happy to summarize and post, if warranted.

View 1 Replies View Related

Compare Schema Between Tables

Oct 6, 2006

In the process of purging data to history tables,
we wanted to make sure that no schema changes have been done
to the main or the history table.
So to ensure identical schemas, we use this function:


ALTER FUNCTION dbo.fnCompareTableSchema
(
@t1Name NVARCHAR(257)
,@t2Name NVARCHAR(257)
)
RETURNS BIT
AS
/*
Compares the schema of 2 tables
If the schema is different RETURNS 0
If the schema is identical between the two table, RETURNS 1
NOTE: system tables or non-existant tables that are NOT in INFORMATION_SCHEMA views will compare equal (RETURNS 1)
==================================================================================================================
SAMPLE USAGE:
DECLARE @schemaOK BIT
SELECT @schemaOK = dbo.fnCompareTableSchema('dbo.table1','dbo.table2')

IF @schemaOK = 1
PRINT 'TABLE SCHEMA IDENTICAL'
ELSE
PRINT 'TABLE SCHEMA DIFFERENT'
==================================================================================================================
*/
BEGIN
IF @t1Name = @t2Name
RETURN 1

-- check if schema is different
IF EXISTS
(
SELECT*
FROM
(
SELECTCOLUMN_NAME, ORDINAL_POSITION, DATA_TYPE
, COLUMN_DEFAULT, IS_NULLABLE
, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE
, COLLATION_NAME
FROMINFORMATION_SCHEMA.COLUMNS
WHERETABLE_SCHEMA = COALESCE(PARSENAME(@t1Name,2),'dbo') AND TABLE_NAME = PARSENAME(@t1Name,1)
UNION ALL
SELECTCOLUMN_NAME, ORDINAL_POSITION, DATA_TYPE
, COLUMN_DEFAULT, IS_NULLABLE
, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE
, COLLATION_NAME
FROMINFORMATION_SCHEMA.COLUMNS
WHERETABLE_SCHEMA = COALESCE(PARSENAME(@t2Name,2),'dbo') AND TABLE_NAME = PARSENAME(@t2Name,1)
) U
GROUP BY
COLUMN_NAME, ORDINAL_POSITION, DATA_TYPE
HAVING COUNT(*) <> 2
)
RETURN 0

-- schema identical
RETURN 1
END

View 6 Replies View Related

Creating A New SQL User For Aspnetdb Membership Db

Jan 1, 2008

Hello - I am using the generic aspnetdb membership database (aspnet_regsql.exe) which I am currently connecting to as a sysadmin user from my website (via web.config). Before going live with my first website I now want to create a sql user for the website to login with, with the minimum permissions required to run the website - the reason for this is to make the db more secure. 
I have created a new sql user and am now looking at what acces they should have. I am OK giving them the required access to the NEW views, sprocs and tables I have created to link in with the generic aspnetdb database etc... however how do I know what access they require to all the BUILT-IN tables, sprocs, views etc. Also, when I am viewing Securables it also brings up all the MASTER DB sprocs, etc.. - will the user need access to these? Should I add the new user to a database role -  which one? (currently I have not given the new user a database role) This is the first time I will have created a sql user for an asp.net website so any help greatly appreciated.
Cheers
Marco  

View 1 Replies View Related

Reading Membership Of All Roles For A User

Feb 22, 2000

I have several roles on a database and want to find out to which roles
a certain user belongs to. What's the SP to get this information?

Background:
I have a table where I store some application specific permissions for
the different roles. I use the same grant/deny/revoke logic like in
SQL server. These are permissions that cannot be mapped to a SP or a
table.
In a query I want to get all the permission records for the role that
a user belongs to.


Thomas Schoch

View 2 Replies View Related

SQL 2012 :: DB Schema Compare Scripts

Apr 16, 2015

I am looking for some SQL Scripts/tool to compare the two sql database and generate the difference results into Excel file. I am not looking for Sync/change scripts.

Example:

Result Type Desc
-----------------------
Col1 Column Added
Table1 Table Removed

View 9 Replies View Related

SQL 2012 :: Schema Compare Tools

Jun 30, 2015

Following an upgrade to SQL Server 2012, our shop's Schema Compare tool (Redgate SQL Compare) is no longer supporting our environment.We are starting to evaluate various 3rd party products to find a possible replacement, and would be interested in what products are favored by other IT shops who do a lot of database work.

Our shop is split about 75% SQL Server, 20% Oracle, and 5% I'll call other. Ideally a product would support SQL Server and Oracle, but our focus is on SQL server right now. On that platform we have ~50 servers spread across DevUATProd environments.In basic terms, we need a tool that can identify schema differences between DBs and generate synchronization scripts to support deploys between environments. Real-time synchronization is not a requirement (nor desirable), as deploys are a gated DBA function in our shop.

View 2 Replies View Related

Needs A SQL 2005 Data And Schema Compare Tool

Mar 12, 2008

Just wondering if there are any tools available for SQL Server 2005 which allow the comparison and scripting of data and schema between two databases. This is so that I can migrate between Dev, QA, and Live easily.

A free tool would be best please..

Thanks in advance.
Gaj

View 11 Replies View Related

VS2013 SSDT Crash On Schema Compare?

Aug 25, 2014

We are getting regular SSDT/VS crashes when doing schema compares (source: project, target: server). Sometimes the compare succeeds but around 80% of the time we get a crash.

We are using VS2013 Update 3 and the latest version of SSDT.

Application : devenv.exe
Version du Framework : v4.0.30319
Description : le processus a été arrêté en raison d'une exception non gérée.
Informations sur l'exception : System.Runtime.InteropServices.COMException
Pile :
   à System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32, IntPtr)

[code]....

View 5 Replies View Related

Export Schema Compare To HTML Report

Jan 3, 2013

I've downloaded and installed the latest SQL Server Data Tools for VS 2012.  Is there anyway to export the results of the schema comparison into a report in CSV/Html format?  I understand that it can generate the sql diff script, but I want a readable report that I can use to show to people.

View 5 Replies View Related

Scripting Variables With Schema Compare Via Msbuild?

Jun 12, 2015

I'm trying to automate comparing the dacpacs we're generating from out builds against our production server to monitor drift.However, we use scripting variables to define cross database references.  The schema compare is showing up all the objects which reference the other database via scripting variable as being different to what is on the server i.e. it reports a change between a table referenced as  [$(db)].dbo.Table in the dacpac  and db.dbo.Table in the target database.

When I do a comparison in Visual studio between the project and the target database the variables seem to be appropriately replaced and the differences don't show.  Obviously this is using a project instead of a dacpac but I'm hoping I can get the dacpac/db compare to behave similarly to the project/db comparison.

Is there a way to define what the scripting variables should resolve to when I run the comparison via msbuild?

Edit:  I would prefer not to deploy the dacpac and diff the deployed db against the target database but if that's the only way....

View 5 Replies View Related

Schema Compare Cannot Exclude Items With Dependencies

Nov 22, 2012

I've made a comparison between a database project (sqlproj) and a database.

I can't exclude some items because they are dependent items on them. So they are implicitly included in the update script.

Unfortunately when I have unchecked all the items, some of them are still implicitly included.

It seems that there are circular dependency or some thing like that.

View 5 Replies View Related

Schema Compare Errors Using Three Part Naming

Jul 28, 2015

I am importing an existing database into a Visual Studio SQL Server Database project using Schema Compare.  The Schema Compare works fine and I updated my project successfully.  However, the project won't build because of the existence of 3-part names in some objects:

E.g. I import the database MyDB into a new project MyDB using Schema Compare.  The database contains views with queries like this:

SELECT col1, col2. col3
FROM MyDB.dbo.MyTable

When trying to build this project I get errors like:

Error 39
SQL71561: View: [dbo].[vw_MyView] has an unresolved reference to object [MyDB].[dbo].[MyTable].
C:UsersRedirectionrittg2DocumentsVisual Studio 2012ProjectsMySolutionMyDBdboViewsvw_MyView_1.sql

but of course this is a bogus message since the view can clearly read from an object in the same database whether using 2-, 3-part naming (or 4-part naming for that matter).

How can I resolve these errors without editing the objects before running Schema Compare? (there are hundreds of them).

View 5 Replies View Related

Filter SqlDataSource Select Based On Membership User Name

Jul 11, 2006

I am running into an issue trying to declaratively set up a SqlDataSource.  I want to be able to filter some of my queries based on the user that is currently logged into the web site.  I want to do it Declaratively as that's one of my favorite 2.0 features.Is there any way to do this with the Membership information?  I know I can use the code behind to set the parameter, or store the User Name in Session Variable, and use a <asp:SessionParameter> but I think there should be a way to bind directly to the Membership user...Am I missing another option, or is there no built in way to do this?  Any other suggestions...Thanks

View 1 Replies View Related

VS 2013 - Schema Compare Is Not Applying Changes To Target Database Project

Aug 11, 2015

I have created Database projects in VS 2013 using SSDT. I have been mostly successful in creating and building the projects without any errors/warnings.

However for one of the databases in the project, when i do schema compare to apply the changes from a SQL Server Database to a Database Project in VS, code changes are not applied to the database project.

After i select the Update option in Schema compare window, I'm getting the following message

"Target update complete. Press Compere to refresh the comparison."

Even tough the message implies that target database is updated successfully, I do not see the objects i selected in schema compare being added to the target database project.

I see the following warning

"Target update: Could not update script for element 'dbo'"

I have 9 Database projects in the Solution and I'm able to apply changes to 8 of the database projects through schema compare successfully. I get the same warning after schema compare for all database projects.

I have same project level setting for all database projects in the solution. I'm using Visual Studio 2013 Premium Update 5 SQL Server Data Tools 12.0.41012.0

View 3 Replies View Related

Dropping Statistics From User Tables

Apr 21, 2008

Hi,

I have founde such a nice code to create statements for dropping all statistics in a database.


DECLARE @tblname sysname, @statname sysname, @sql nvarchar(2000)

DECLARE c CURSOR FOR

SELECT object_name(id), name FROM sysindexes WHERE INDEXPROPERTY(id, name, 'IsStatistics') = 1

OPEN c

FETCH NEXT FROM c INTO @tblname, @statname

WHILE @@FETCH_STATUS = 0

BEGIN

SET @sql = 'DROP STATISTICS [' + @tblname + '].[' + @statname + ']'

PRINT @sql

FETCH NEXT FROM c INTO @tblname, @statname

END

CLOSE c

DEALLOCATE c



Please help me with changing this code to take care only on indexes from my own tables (no system ones).

Thanks for your help.

Przemo

View 5 Replies View Related

SQL 2012 :: Database Project Schema Compare Fails To Pull In CDC Tables

Jul 11, 2014

I have a database project where objects have been pulled in from the database using schema compare.

Unfortunately CDC tables which are referenced in stored procedures on the database have not been pulled in by the schema compare & hence I cannot build the project and deploy changes back to the database.

How to get these tables included in the project .

View 1 Replies View Related

Dropping User Created Tables From Master Db

Aug 25, 2006

Hi,
I have created a bunch of tables in the Master db by mistake.I want to drop those tables.Please tell me away to drop those.

Thanks!!

View 2 Replies View Related

SQL Security :: What Permission Required To Restrict User From Dropping The Object

Nov 9, 2015

I want to grant  CREATE, ALTER, VIEW  permission to user but not DML permission?

So user can create Object but can't drop and delete it or user cant  insert , update,delete from table.

I have Given db_datareader,db_denydatawriter, and granted create, select, alter permission.

But user is able to drop.

View 3 Replies View Related

SQL Security :: Schema Name Same As User Name

Jun 28, 2015

In some our dotabases I can see Schemas created with the same name as Domain User name (domainusername). Schema owner for those schemas is not dbo but the same user as in schema name. How this happens? Is any way to prevent or prohibit this?

View 9 Replies View Related

Schema/user Details In SQL Server2005

Aug 22, 2006

We are using SQL Server2005 on Windows XP.

My question is:
What is the difference b/w schema, owner and user in SQL Server 2005. The reason for asking is that when I login as a user say 'user1' and create objects under it.. they should show up in its own schema - right. Because this is how Oracle works. Now we are not seeing this behaviour in SQL Server2005. Instead, we see the object created with <dbo>.<object_name>.

Are we missing something? thanks.

View 4 Replies View Related

Varying Ddl Permissions For A User By Schema

May 18, 2007

Is it possible to set up the permissions to not allow a specific user to create schemas, but to allow that user to create tables and procedures and functions in one schema, and to create procedures and functions but not tables, in a different schema within the same database?



View 3 Replies View Related

SQL Security :: Restrict A User Only To Particular Schema

Sep 23, 2015

I have created a user Finance and I want to grant him access only to see views which are created under Schema called "FinanceQuery".

Note: View may use tables from multiple schemas example: dbo. Staging. ect 

By doing this, I want to achieve that this user Finance can see only Views created under Schema FinanceQuery and should not see any other objects (tables, Stored Procedures, Functions etc.)

View 3 Replies View Related

User Granted Execute On Schema

Aug 8, 2006

I have granted execute on the dbo schema to a sql user so that he can execute available procedures in the dbo schema. However when he executes a procedure ie..

exec dbo.myproc

The following error is returned:

Msg 229, Level 14, State 5, Line 2

SELECT permission denied on object 'MyType', database 'Mine', schema 'dbo'.

MyType is a table

How can I correct this behavior?

I don't want the user to be able to access the tables except via the procedure calls.

View 5 Replies View Related

SQL Security :: How To Set Permissions For A User On X And Y Schema

Oct 22, 2015

I need to provide a User with below permissions:

1. Ability to read and write records in tables in both the X schema and Y schema
2. Ability to read metadata about objects in the X and Y schema
3. Ability to execute stored procedures in the X and Y schema
4. Ability to create and update the necessary schema objects used by X, including but not limited to tables, views, and indexes
5. CREATE FUNCTION permission
6. ALTER and EXECUTE permissions on the X schema
7. VIEW DEFINITION permission on the X and Y schemas to enable view export. 

For the point 1, I will assign db_datareader,db_datawriter database roles to the user

For the point 2, when I have searched web, I found out ReadDefinition permission should be granted. I could find only viewDefinition but not ReadDefinition.

For the point 3, 'USE DataBaseName GRANT EXECUTE TO User; Go' - does this sql suffice?

For the point 4, I am not sure what should be done.

For the point 5, 'USE DataBaseName GRANT CREATE FUNCTION TO User; Go' - I guess this will work

For the point 6, Can I use same SQL as point 3 including ALTER ?

For the point 7, 'USE DataBaseName GRANT VIEW DEFINITION TO User; Go'

View 5 Replies View Related

Discrete User Schema Permissions

Oct 1, 2007



Hi all,
I am trying to establish a "sandbox" database for a group of users/developers whereby each user has their own schema and complete control over their schema and only their schema.

I began by creating user logins (Windows Authentication), created schemas for each user where the corresponding login is the owner, and set the schema as default for the user.

At this point, the logins only had "public" and could not create tables. I then granted the Create Table privilege which allowed them to create a table in their schema. However, they could also create tables anywhere else in the database including another user's schema.
How can I set up an enironment where each user has control over just their schema? What permissions would I need to grant and at what level (database,schema, etc.). I also need them to be able to grant privileges on their own schema and/or schema objects.
Any help would be greatly appreciated.

View 4 Replies View Related

Using Membership UserId Guids With SqlParameters (Membership UserId Guid)

May 7, 2008

In my site, when a user registers, I need to create rows in additional tables besides aspnet_Users. So, I need to be able to pass the generated userId guid to subsequent SqlCommands. I'm having a terrible time with this. What's the correct way to set up a SqlParameter so that it will accept a guid? I keep getting this error: "Conversion failed when converting from a character string to uniqueidentifier."
I've tried creating the parameter both with and without a SqlDbType.
cmd.Parameters.AddWithValue(paramName, guid);
and
SqlParameter p = new SqlParameter(paramName);p.SqlDbType = SqlDbType.Guid;cmd.Parameters.Add(p);
and I get the same error either way.
Driving me nuts! Any help appreciated.

View 1 Replies View Related

Can Sp_grantdbaccess Attach User To Default Schema

Jun 15, 2007

Hi
For MSSQL 2005 server, when we create new user using stored procedure sp_grantdbaccess, it creates schema with name given to user.

While when we create new user with query " Create login identfied by'password'. It attach user to default schema at the server.


My question is can we have a default schema assigned to the user, while user is created with sp_grantdbaccess?

Is there any way to do so?

Please reply as early as possible.

View 3 Replies View Related

User/schema Problem In SQL Server 2005!

Oct 13, 2006

do the following steps:1:Use Manage Studio login the server with Integrated security.2:Create a dabase named testdb;3:Create a SQL Server login named amber ,and set it to be dbowner oftestdb;4:Create a SQL Server login named guxiaobo ,set it's default databse tobe testbd,and in the testdb databse map login guxiaobo to userguxiaobo;5:Close Manage Studio and reopen it ,this time use login amber log tothe server.6:In database testbd create a databse role role1 owned by dbo;7:In database testdb create a schema schema1 owned by dbo;8:Set user guxiaobo to be member of role1,and set guxiaobo's defaultschema to be schema1;9:In the schema properties-schema1 dialog choose permissions,in theusers or roles listview I add role1 to it.in the explicit permissionsfor role1 listbox,I choose select /update/insert/delete/view definitiongrant checkboxes.and apply the selects.10:In the schema1 schema I create a table:create table a(a int ,bvarchar(10));11:In the dabase role properties-role1 dialog choose securables panel,int securable listview I add the schema1.a table( choose all thecolumns of table a for all permissions),and in explicit permissions forschema1.a I choose all for grant ,then apply the selects.12:Now I use login guxiaobo to log into dabase and issue "select * froma",but got a error msg saying guxiaobo has not enough permission toselect form table a.Does anyone has found anything I missed?

View 6 Replies View Related

Giving A User Permissions On Objects In A Schema

Nov 22, 2006

Hi,

SQL Server Security is not my strong point so forgive me for asking stupid questions.

 

I have a bunch of tables and sprocs within a schema 'MySchema'. I have a user 'MyUser' defined in the database.

I would like to give MyUser permission to SELECT from tables and EXECUTE all sprocs in MySchema. What is the simplest way of doing that? Will the following:

GRANT EXECUTE ON SCHEMA::[MySchema] TO [MyUser] WITH GRANT OPTION AS [db_owner]
GRANT SELECT ON SCHEMA::[MySchema] TO [MyUser] WITH GRANT OPTION

accomplish that? (I can't test it out at the moment because our DBA isn't around and I don't have permission)

 

With best practices in mind - is what I am doing here considered "ok". Any suggestions/comments are welcome.

-Jamie

 

P.S. Can anyone recommend any documentation that talks about what best practices should be in the use of schemas. BOL is a bit sparse. Thanks.

 

View 5 Replies View Related

Set Default Schema To Current User For Call Database

Apr 20, 2013

i have database and set default table schema to "ray" and me must input ruy.TABLE-NAME for retrive data !!! , i need set Default Schema to current user for call database as just database name(for my program) , how changed it ? (i change default schema for current user by alter command but not worked !)

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved