Click here to Skip to main content
15,888,454 members
Home / Discussions / Database
   

Database

 
GeneralRe: how can optimize a query in sql server Pin
PIEBALDconsult18-Nov-13 15:42
mvePIEBALDconsult18-Nov-13 15:42 
AnswerRe: how can optimize a query in sql server Pin
Jörgen Andersson18-Nov-13 3:00
professionalJörgen Andersson18-Nov-13 3:00 
QuestionSRSS 2008 RepeatOnNewPage not really work on the “2nd last” page Pin
F.E.L.I.X.15-Nov-13 0:44
F.E.L.I.X.15-Nov-13 0:44 
GeneralMessage Closed Pin
14-Nov-13 15:34
professionalMember 1040275014-Nov-13 15:34 
GeneralRe: Hadoop + esProc Help You Replace IOE Pin
Eddy Vluggen14-Nov-13 22:29
professionalEddy Vluggen14-Nov-13 22:29 
Questionstoredprocedures Pin
Member 1039766114-Nov-13 4:07
Member 1039766114-Nov-13 4:07 
AnswerRe: storedprocedures Pin
Eddy Vluggen14-Nov-13 6:52
professionalEddy Vluggen14-Nov-13 6:52 
GeneralRe: storedprocedures Pin
Member 1039766114-Nov-13 7:31
Member 1039766114-Nov-13 7:31 
SQL
ALTER PROCEDURE [dbo].[UpdateSurvey]
    -- Add the parameters for the stored procedure here
    @ID int,@response nvarchar(50),@buildingpoint  nvarchar(50),@ID1 int
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

if(@ID1=1)
Begin
UPDATE survey  SET
 ques_1 = (select response from surveyanswers t2 where id=@response),q1buildpoint=(select buildingpoint from surveyanswers t2 where id=@buildingpoint)
from survey c
inner join surveyanswers s
on s.id = c.cid
where c.cid = @ID
End

Else If(@ID1=2)

Begin
UPDATE survey  SET
 ques_2a = (select response from surveyanswers t2 where id=@response),q2abuildpoint=(select buildingpoint from surveyanswers t2 where id=@buildingpoint)
from survey c
inner join surveyanswers s
on s.id = c.cid
where c.cid = @ID
End

Else If(@ID1=3)

Begin
UPDATE survey  SET
 ques_2b = (select response from surveyanswers t2 where id=@response),q2bbuildpoint=(select buildingpoint from surveyanswers t2 where id=@buildingpoint)
from survey c
inner join surveyanswers s
on s.id = c.cid
where c.cid = @ID
END
Else If(@ID1=4)

Begin

UPDATE survey  SET
 ques_2c = (select response from surveyanswers t2 where id=@response),q2cbuildpoint=(select buildingpoint from surveyanswers t2 where id=@buildingpoint)
from survey c
inner join surveyanswers s
on s.id = c.cid
where c.cid = @ID

END
Else If(@ID1=5)

Begin


UPDATE survey  SET
 ques_3 = (select response from surveyanswers t2 where id=@response),q3buildpoint=(select buildingpoint from surveyanswers t2 where id=@buildingpoint)
from survey c
inner join surveyanswers s
on s.id = c.cid
where c.cid = @ID
END

Else If(@ID1=6)

Begin
UPDATE survey  SET
 ques_4 = (select response from surveyanswers t2 where id=@response),q4buildpoint=(select buildingpoint from surveyanswers t2 where id=@buildingpoint)
from survey c
inner join surveyanswers s
on s.id = c.cid
where c.cid = @ID

END
Else If(@ID1=7)

Begin
UPDATE survey  SET
 ques_5 = (select response from surveyanswers t2 where id=@response),q5buildpoint=(select buildingpoint from surveyanswers t2 where id=@buildingpoint)
from survey c
inner join surveyanswers s
on s.id = c.cid
where c.cid = @ID

END
Else If(@ID1=8)

Begin
UPDATE survey  SET
 ques_6 = (select response from surveyanswers t2 where id=@response),q6buildpoint=(select buildingpoint from surveyanswers t2 where id=@buildingpoint)
from survey c
inner join surveyanswers s
on s.id = c.cid
where c.cid = @ID
   END

Else If(@ID1=9)

Begin
UPDATE survey  SET
 ques_7 = (select response from surveyanswers t2 where id=@response),q7buildpoint=(select buildingpoint from surveyanswers t2 where id=@buildingpoint)
from survey c
inner join surveyanswers s
on s.id = c.cid
where c.cid = @ID

END
Else If(@ID1=10)

Begin
UPDATE survey  SET
 ques_8 = (select response from surveyanswers t2 where id=@response),q8buildpoint=(select buildingpoint from surveyanswers t2 where id=@buildingpoint)
from survey c
inner join surveyanswers s
on s.id = c.cid
where c.cid = @ID


output


exec UpdateSurvey 5,5,5,2(id,response,buildingpoint,@ID1=2)
but instead of updating @ID1=2 ,it updates @ID1=5 .BUT I want to update @ID1=2 query .Is there any solution for this

GeneralRe: storedprocedures Pin
Eddy Vluggen16-Nov-13 1:26
professionalEddy Vluggen16-Nov-13 1:26 
QuestionAlter statement - Pin
vkEE13-Nov-13 4:46
vkEE13-Nov-13 4:46 
AnswerRe: Alter statement - Pin
Richard Deeming13-Nov-13 5:10
mveRichard Deeming13-Nov-13 5:10 
AnswerRe: Alter statement - Pin
RedDk15-Nov-13 11:55
RedDk15-Nov-13 11:55 
QuestionOLAP database missing... Pin
SalCon12-Nov-13 22:46
SalCon12-Nov-13 22:46 
SuggestionRe: OLAP database missing... Pin
Richard MacCutchan13-Nov-13 0:37
mveRichard MacCutchan13-Nov-13 0:37 
AnswerRe: OLAP database missing... Pin
GuyThiebaut13-Nov-13 2:57
professionalGuyThiebaut13-Nov-13 2:57 
QuestionMariaDB and c# Pin
Septimus Hedgehog12-Nov-13 3:59
Septimus Hedgehog12-Nov-13 3:59 
AnswerRe: MariaDB and c# Pin
Simon_Whale13-Nov-13 3:40
Simon_Whale13-Nov-13 3:40 
GeneralRe: MariaDB and c# Pin
Septimus Hedgehog13-Nov-13 7:29
Septimus Hedgehog13-Nov-13 7:29 
AnswerTested successfully. Pin
Septimus Hedgehog14-Nov-13 1:12
Septimus Hedgehog14-Nov-13 1:12 
QuestionConcat NULL yields NULL inside a Function Pin
Fabricio Dos Santos Antunes12-Nov-13 0:36
Fabricio Dos Santos Antunes12-Nov-13 0:36 
AnswerRe: Concat NULL yields NULL inside a Function Pin
Simon_Whale12-Nov-13 1:01
Simon_Whale12-Nov-13 1:01 
AnswerRe: Concat NULL yields NULL inside a Function Pin
Mycroft Holmes12-Nov-13 1:57
professionalMycroft Holmes12-Nov-13 1:57 
SuggestionRe: Concat NULL yields NULL inside a Function Pin
Richard Deeming12-Nov-13 3:08
mveRichard Deeming12-Nov-13 3:08 
GeneralRe: Concat NULL yields NULL inside a Function Pin
Fabricio Dos Santos Antunes13-Nov-13 6:26
Fabricio Dos Santos Antunes13-Nov-13 6:26 
QuestionAccess 2003 tables to link sqlexpress 2005 but i had not seen table .DBO ? Pin
Member 245846711-Nov-13 17:02
Member 245846711-Nov-13 17:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.