I know I'm missing something obvious and most likely just need some sleep to figure it out,but I'm trying to finish a block of auditing code off to hit a deadline. I can't figure out why I get an error when I try to do the following:
CREATE
USER audituser WITHOUT LOGINGO
CREATE
SCHEMA audit AUTHORIZATION audituserGO
EXECUTE
AS USER = 'audituser'GO
--Create new, flexible audit structure
CREATE
TABLE audit.AuditTable(
AuditID int identity(1,1),TableName
sysname NOT NULL,AuditAction
char(2) NOT NULL,RowData
xml NOT NULL,AuditDate
datetime NOT NULL CONSTRAINT df_table1_audit_editdate DEFAULT (getdate()),AuditUser
varchar(30) NOT NULL CONSTRAINT df_table1_audit_edituser DEFAULT (suser_sname()),CONSTRAINT
pk_table1_audit PRIMARY KEY CLUSTERED (AuditID))GO
The user and schema are created properly. audituser is the owner of the schema and therefore should have the authority to do anything at all within the schema. However, the create table statement is failing and saying CREATE TABLE permission denied. Why