By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,750 Members | 1,471 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,750 IT Pros & Developers. It's quick & easy.

getting error "“Invalid object name 'SizeMst'. “ " while exec sp

P: 29
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,screate ddt,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,bcrea teddt,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,m createddt,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
Jul 7 '07 #1
Share this Question
Share on Google+
1 Reply


P: 99
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,screate ddt,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,bcrea teddt,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,m createddt,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


Invalid object name 'SizeMst'.It means the table is missing in the database.
Check the tablename u given is correct and exist in current database
Jul 9 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.