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 2000 Forums
 SQL Server Development (2000)
 Condition in insert into

Author  Topic 

kwikwisi
Constraint Violating Yak Guru

283 Posts

Posted - 2008-04-09 : 02:23:17
my stored procedure is like that and i don't want to insert if @proansw is null.
Plz help me.

CREATE PROCEDURE [dbo].[sp_AddAnsTemp]
@proid int, @prodesc nvarchar(50), @proansw nvarchar(50)
AS
insert into TempAns(ProblemID,ProblemDescription,ProblemAnswer)
values (@proid, @prodesc, @proansw)
GO

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-09 : 02:42:00
CREATE PROCEDURE [dbo].[sp_AddAnsTemp]
@proid int, @prodesc nvarchar(50), @proansw nvarchar(50)
AS
if @proansw is not null
begin
insert into TempAns(ProblemID,ProblemDescription,ProblemAnswer)
values (@proid, @prodesc, @proansw)
end



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

kwikwisi
Constraint Violating Yak Guru

283 Posts

Posted - 2008-04-09 : 03:53:40
thanks
Go to Top of Page

kwikwisi
Constraint Violating Yak Guru

283 Posts

Posted - 2008-04-09 : 04:19:54
hi,
i have table1(id,desc,reso) and view1(id,uid,desc,reso)
i want id and desc from table1 if t.id<>v.id
i also need to combine these view and table to get uid from view
how can i get my target?

plz help me!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-09 : 11:53:12
quote:
Originally posted by kwikwisi

hi,
i have table1(id,desc,reso) and view1(id,uid,desc,reso)
i want id and desc from table1 if t.id<>v.id
i also need to combine these view and table to get uid from view
how can i get my target?

plz help me!



Can you provide some sample data to make this more clear?
Go to Top of Page
   

- Advertisement -