[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

SQL Error Msg 4988 when Creating Table with persisted Computed column

Posted on 2011-03-22
3
Medium Priority
?
707 Views
Last Modified: 2012-05-11
Hi,
I'm trying to create a table in SQL 2008 that has a Computed column with Presisted property. The Computed formula calls a user defined function in dbo schema. However, table it self resides in a different schema.

When I execute the following (see the code).  I get this error telling me that my table has different owner then the underlaying function.  I even deleted the function and recreated it using the same user login that is creating the table.  How do I fix this.  I Can not put the function into the same schema as the table.  This function must reside in dbo schema because of replication.

Msg 4988, Level 16, State 1, Line 2
Cannot persist computed column 'JoinedName'. Underlying object 'JoinName' has a different owner than table 'Users'.
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

SET ARITHABORT ON
GO

CREATE TABLE [PublicFacing].[Users](
      [UserId] [int] NOT NULL,
      [RegistrantId] [int] NOT NULL,
      [IsPublic] [bit] NOT NULL,
      [Password] [varchar](50) NULL,
      [PasswordMD5] [char](32) NULL,
      [PasswordActivation] [datetime] NULL,
      [ReplicationGUID] [uniqueidentifier] NOT NULL,
      [msrepl_tran_version] [uniqueidentifier] NULL,
      [Status] [smallint] NULL,
      [FirstName] [varchar](80) NULL,
      [MiddleName] [varchar](80) NULL,
      [LastName] [varchar](80) NULL,
      [Suffix] [varchar](80) NULL,
      [Prefix] [varchar](15) NULL,
      [JoinedName]  AS ([dbo].[JoinName]([FirstName],[MiddleName],[LastName],[Suffix])) PERSISTED,
      [AddressLine1] [varchar](60) NULL,
      [AddressLine2] [varchar](60) NULL,
      [USCity] [varchar](60) NULL,
      [USState] [smallint] NULL,
      [USZip5] [int] NULL,
      [USZip4] [smallint] NULL,
      [Country] [smallint] NULL,
      [LastStatusChange] [datetime] NULL,
CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED 
(
      [UserId] ASC,
      [RegistrantId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [PublicFacing].[Users] ADD  CONSTRAINT [DF_Users_ReplicationGUID]  DEFAULT (newid()) FOR [ReplicationGUID]
GO

ALTER TABLE [PublicFacing].[Users] ADD  CONSTRAINT [MSrepl_tran_version_default_C3AE8422_2E32_4716_8BDE_71A88E4EE9DE_791673868]  DEFAULT (newid()) FOR [msrepl_tran_version]
GO

Open in new window

0
Comment
Question by:vb7guy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Assisted Solution

by:Kobe_Lenjou
Kobe_Lenjou earned 1000 total points
ID: 35189646
Can you verify if the owers of both schema's are the same (most likely dbo)?
 
select * from sys.schemas

Open in new window


0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1000 total points
ID: 35190578
>Cannot persist computed column 'JoinedName'. Underlying object 'JoinName' has a different owner than table 'Users'.
as the error message reads, the function you want to use has to be in the same owner as the table. either both dbo, or both "users"
0
 

Author Closing Comment

by:vb7guy
ID: 35314246
Both solutions were on the correct path.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question