I found few database users (SQL users) with no login in the database. These are orphaned users
The following query is run in the database context
-- SQL to run to identify users without login :
SELECT CASE WHEN DATALENGTH(sid) = 28
AND type = 'S' -- only want SQL users
AND principal_id > 4 -- ignore built in users
THEN 1 ELSE 0 END AS is_user_without_login,*
FROM sys.database_principals
--I found the user where is_user_without_login = 1
--dropped the user
--and created the user linking the user to the login
use db_01
GO
drop user dbuser1
create user dbuser1 for login svrlogin1
This blog is created to add all the information and experiences that I have learnt while working on MS sql server as a DBA. The blog is also updated frequently with the real world problem that I encounter hands on at work and the resolutions to resolve them. I hope this blog will be of some use to you and you will revisit. Thank you for stopping by and you are welcome to leave comments.
Thursday, February 16, 2017
Wednesday, February 1, 2017
SSIS: Split the file into error file upon error while inserting to the destinaltion table
The SSIS imports a flat file to the SQL table and upon error it writes out the error lines ( including the contents to the a new file e.g. file1_error.txt and inserts the error records ( account number and the row number in this case) to the error ruble in the database. This multiple tasks are possible by the Multicast step.
The script component: Script to update the rowcount is used to count the rows in the source file.
int _RowNumber = 2;
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
Row.RowNumber = _RowNumber;
_RowNumber += 1;
}
The script component: Script to update the rowcount is used to count the rows in the source file.
int _RowNumber = 2;
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
Row.RowNumber = _RowNumber;
_RowNumber += 1;
}
Subscribe to:
Posts (Atom)