Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 getting error "“Invalid object name 'SizeMst'. “ "

Author  Topic 

imranabdulaziz
Yak Posting Veteran

83 Posts

Posted - 2007-07-07 : 02:03:18
Dear All,

I am using sql2005.
i am writing stored procedure to save various master data . I recognize master by @type (input verible) and assign it to @mst veriable then based on @mst no I perform saving task . I created sp . now I am trying to execute then I am getting error
“Invalid object name 'SizeMst'. “ I am running this query from its database.

Stored perocedure is

Alter procedure [dbo].[Sp_RestMst_Save]
@type int ,
@id varchar(20),
@shortdesp varchar(50),
@longdesp varchar(100),
@userid varchar(50),
@ipadd varchar(50)
as
declare @mst int
set @mst = @type

if ( @mst = 1)
begin ;
-- saving data in sizemst

update SizeMst set sshortdesp = @shortdesp , sdesp = @longdesp,smodifiedby = @userid , smodifieddt = getdate() ,ipadd = @ipadd where sizeid = @id;
if(@@rowcount = 0)
insert into SizeMst(sizeid,sshortdesp,sdesp,screatedby,screateddt,ipadd) values(@id,@shortdesp,@longdesp,@userid, getdate(),@ipadd);


end ;
else
if(@mst = 2)
begin ;
-- saving data in brandMst
update BrandMst set bshortdesp = @shortdesp ,bdesp = @longdesp, bmodifiedby = @userid , bmodifieddt = getdate() ,ipadd = @ipadd where brandid = @id;
if(@@rowcount = 0)
insert into brandMst(brandid,bshortdesp,bdesp,bcreatedby,bcreateddt,ipadd) values(@id,@shortdesp,@longdesp,@userid, getdate(),@ipadd);

end ;
else
if(@mst = 3)
begin ;
-- saving data in metalktmst
update MetalKtMst set mshortdesp = @shortdesp ,mdesp = @longdesp, mmodifiedby = @userid , mmodifieddt = getdate() ,ipadd = @ipadd where metalktid = @id;
if(@@rowcount = 0)
insert into MetalKtMst(metalktid,mshortdesp,mdesp,mcreatedby,mcreateddt,ipadd) values(@id,@shortdesp,@longdesp,@userid, getdate(),@ipadd);

end ;







Please guide me in doing so or give me some useful link.
Thanks



regards
imran khan

sachinsamuel
Constraint Violating Yak Guru

383 Posts

Posted - 2007-07-07 : 03:13:20
Check if 'SizeMst' exists in the database or not. If its there, then check the owner of the table. It might be a different owner than the one you are logged in.

Thanks
Sachin

Don't sit back because of failure. It will come back to check if you still available. -- Binu
Go to Top of Page
   

- Advertisement -