Tuesday, March 27, 2012

Create Table In Store Procedure and inserting data with the Kalen user.

Hello.
First: Sorry for my inglish.
I'need create this "simple" SP
I Work with (SQL 2000 + SP4)
Use TempDB
GO
Create procedure DBO.ProcTest
as
drop table Tempdb..TabTest
create table Tempdb..TabTest (a int)
insert into Tempdb..TabTest values (1000)
GO
grant exec on DBO.ProcTest to public
When I execute this SP whit the user Kalen (She have "Create table"
permission on TempDB) I receive this message
--Invalid object name 'Tempdb..TabTest'
This is beacuse SQL find a Temp.DBO.TabTest or not?. but if execute the
code in the Query analyzer, not have this problem.
The question is: Exist a solution without SQL Dynamic, with persistent table
and creating only one Procedure (not a procedure for each user)?
Thank You
Fernando Flamenco
Ing Sistemas de Informacin
Buenos Aires - Argentina.First of all don't create tables in TempDB. TempDB is a system database.
"Fernando Flamenco" <flamencof@.yahoo.com> wrote in message
news:uD8UmEFgGHA.1260@.TK2MSFTNGP05.phx.gbl...
> Hello.
> First: Sorry for my inglish.
> I'need create this "simple" SP
> I Work with (SQL 2000 + SP4)
> Use TempDB
> GO
> Create procedure DBO.ProcTest
> as
> drop table Tempdb..TabTest
> create table Tempdb..TabTest (a int)
> insert into Tempdb..TabTest values (1000)
> GO
> grant exec on DBO.ProcTest to public
> When I execute this SP whit the user Kalen (She have "Create table"
> permission on TempDB) I receive this message
> --Invalid object name 'Tempdb..TabTest'
> This is beacuse SQL find a Temp.DBO.TabTest or not?. but if execute the
> code in the Query analyzer, not have this problem.
> The question is: Exist a solution without SQL Dynamic, with persistent
> table and creating only one Procedure (not a procedure for each user)?
> Thank You
> Fernando Flamenco
> Ing Sistemas de Informacin
> Buenos Aires - Argentina.
>

No comments:

Post a Comment