Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

owner data objects
I've a problem.

In my MSSql db I've some tables named username.mytable and only one
store procedure named dbo.sp;


CREATE TABLE [pippo].[mytable] (
[year]  [int] NOT NULL ,
[month] [int] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [pluto].[mytable] (
[year]  [int] NOT NULL ,
[month] [int] NOT NULL
) ON [PRIMARY]
GO

CREATE PROCEDURE [dbo].[sp]
AS
select * from mytable
GO


but when I try to execute dbo.sp (from pippo or pluto connection) I've
this error (users pippo and pluto are owner):

Server: Msg 208, Level 16, State 1, Procedure sp, Line 4
Invalid object name 'mytable'.

How can I access to pippo's (or pluto's) data from dbo.sp?


thanks!!

Report this thread to moderator Post Follow-up to this message
Old Post
zMatteo
03-30-05 02:41 PM


Re: owner data objects
zMatteo (origma@edpsistem.it)  writes:
> I've a problem.
>
> In my MSSql db I've some tables named username.mytable and only one
> store procedure named dbo.sp;
>
>
> CREATE TABLE [pippo].[mytable] (
>      [year]  [int] NOT NULL ,
>      [month] [int] NOT NULL
> ) ON [PRIMARY]
> GO
>
> CREATE TABLE [pluto].[mytable] (
>      [year]  [int] NOT NULL ,
>      [month] [int] NOT NULL
> ) ON [PRIMARY]
> GO
>
> CREATE PROCEDURE [dbo].[sp]
> AS
>   select * from mytable
> GO
>
>
> but when I try to execute dbo.sp (from pippo or pluto connection) I've
> this error (users pippo and pluto are owner):
>
>     Server: Msg 208, Level 16, State 1, Procedure sp, Line 4
>     Invalid object name 'mytable'.
>
> How can I access to pippo's (or pluto's) data from dbo.sp?

SELECT * FROM pippo.mytable

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Report this thread to moderator Post Follow-up to this message
Old Post
Erland Sommarskog
03-30-05 02:41 PM


Re: owner data objects
Erland Sommarskog <esquel@sommarskog.se> wrote in message news:< Xns9629B0769BAFBYazo
rman@12
7.0.0.1>...
> zMatteo (origma@edpsistem.it) writes: 
>
> SELECT * FROM pippo.mytable


but for user pluto i'd make a new store procedure...
I'd resolve the problem (attention: it's ok only for not sysadmin users)!!:

CREATE TABLE [dbo].[mytable] (
[user]  [smallint] NOT NULL,
[year]  [int] NOT NULL ,
[month] [int] NOT NULL
) ON [PRIMARY]
GO


CREATE VIEW [dbo].[myview]
AS
select * from mytable
where user=user_id()
GO


CREATE PROCEDURE [dbo].[sp]
AS
select * from myview
GO

Report this thread to moderator Post Follow-up to this message
Old Post
zMatteo
03-31-05 12:01 PM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 11:49 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006