dbo

SQL schemas - dbo.<tablename> has to go

。_饼干妹妹 提交于 2020-01-06 10:38:13
问题 I'm still pretty new to SQL and all the related issues that resemble mine really don't clarify anything. My problem is this: We have a widely used piece of administration software, which can either use MDB or SQL. Some time ago, I migrated the MDB to a new SQL server instance, this setup has been running smoothly for some time now. I no longer had some of the drawbacks that an Access database has. Now, a new piece of software we're using connects to that same database to append data. It can

lu.[TableName] instead of dbo.[TableName]?

三世轮回 提交于 2020-01-04 01:39:52
问题 Some of the tables in my SQL Server 2005 database is named as lu.[TableName] instead of dbo.[TableName]. What does lu stand for? Note: I tried google already 回答1: That would be a schema in SQL Server 2005 - which you can create yourself using CREATE SCHEMA. A schema can be used to separate out database objects that logically belong together, e.g. put all tables related to human resources into a "HR" schema etc. DB Schemas are a bit like .NET or XML namespaces. A schema can also be used to

Assign role of db_denydatawriter to user dbo

孤街醉人 提交于 2019-12-22 12:40:14
问题 When I try to do this I receive the following error message: Add member failed for DatabaseRole 'db_denydatawriter'. (Microsoft.SqlServer.Smo) ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) Cannot use the reserved user or role name 'dbo'. (Microsoft SQL Server, Error: 15405) I have a database that needs to remain 'frozen'. I want to maintain ownership of the database , but prevent myself (as dbo) from

DBO rights risk

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 01:08:09
问题 I'm advising a friend who manages a SQL 2k5 box that has several users who have dbo access to multiple databases. The problem is: These users haven't had their passwords changed for some months, These users put their IDs into applications and the applications run as DBO. So - aside from the obvious dbo rights to add/update/delete tables and procs, what dangers can I cite for a malicious user having dbo to a SQL 2005 database? I'd like to provide specific scenarios that pose harm to the

pdo prepared statement insert DEFAULT when the variable in BindParam is null

吃可爱长大的小学妹 提交于 2019-12-10 15:30:31
问题 I have this problem: I'm using PDO prepared statement.... I want to BIND a variable BUT if the variable is NULL it have to INSERT in MYSQL the DEFAULT VALUE of the field... I'm trying with IFNULL(:User_Login__Is_Active, DEFAULT), And I tried also: COALESCE(:User_Login__Is_Active, DEFAULT), Same error: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; How can you do that? Look this example: $stmt = $this->pdo->prepare('INSERT INTO user

Assign role of db_denydatawriter to user dbo

妖精的绣舞 提交于 2019-12-06 06:37:43
When I try to do this I receive the following error message: Add member failed for DatabaseRole 'db_denydatawriter'. (Microsoft.SqlServer.Smo) ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) Cannot use the reserved user or role name 'dbo'. (Microsoft SQL Server, Error: 15405) I have a database that needs to remain 'frozen'. I want to maintain ownership of the database , but prevent myself (as dbo) from accidentally modifying the data. Is there another way to accomplish this? EDIT: I've decided to open a new

Is there a way to use a function on a Microsoft SQL Server Query without using “dbo.” before the function?

你。 提交于 2019-11-30 05:56:56
问题 Is there a way to call a User defined function without using "dbo." before the function name and parameters? Using: SELECT USERFUNCTION(PARAM1, PARAM2, PARAM3, PARAMN) instead of: SELECT dbo.USERFUNCTION(PARAM1, PARAM2, PARAM3, PARAMN) 回答1: This isn't possible for the SELECT syntax. BOL States: "Scalar-valued functions must be invoked by using at least the two-part name of the function" This syntax works however. CREATE FUNCTION USERFUNCTION (@p INT) RETURNS INT AS BEGIN RETURN (2) END GO

Is there a way to use a function on a Microsoft SQL Server Query without using “dbo.” before the function?

ぃ、小莉子 提交于 2019-11-28 10:59:28
Is there a way to call a User defined function without using "dbo." before the function name and parameters? Using: SELECT USERFUNCTION(PARAM1, PARAM2, PARAM3, PARAMN) instead of: SELECT dbo.USERFUNCTION(PARAM1, PARAM2, PARAM3, PARAMN) This isn't possible for the SELECT syntax. BOL States: " Scalar-valued functions must be invoked by using at least the two-part name of the function " This syntax works however. CREATE FUNCTION USERFUNCTION (@p INT) RETURNS INT AS BEGIN RETURN (2) END GO DECLARE @rc INT EXEC @rc = USERFUNCTION 1 SELECT @rc It is best practice to always schema qualify objects you