Click here to Skip to main content
15,890,438 members
Home / Discussions / Database
   

Database

 
AnswerRe: about Oracle & SQLPLUS Pin
Yusuf4-Aug-10 13:51
Yusuf4-Aug-10 13:51 
AnswerRe: about Oracle & SQLPLUS Pin
Jörgen Andersson4-Aug-10 20:48
professionalJörgen Andersson4-Aug-10 20:48 
AnswerRe: about Oracle & SQLPLUS Pin
Bernhard Hiller4-Aug-10 21:28
Bernhard Hiller4-Aug-10 21:28 
GeneralRe: about Oracle & SQLPLUS Pin
alexyxj5-Aug-10 11:10
alexyxj5-Aug-10 11:10 
QuestionHow to display data effectively [modified] Pin
Frygreen4-Aug-10 9:02
Frygreen4-Aug-10 9:02 
AnswerVeiws ? Pin
David Mujica4-Aug-10 9:59
David Mujica4-Aug-10 9:59 
GeneralRe: Views ? Pin
Frygreen5-Aug-10 10:27
Frygreen5-Aug-10 10:27 
QuestionHelp with this Stored proc Pin
soorma4-Aug-10 5:20
soorma4-Aug-10 5:20 
I am trying to get the questionID from two different Select statements and
then insert into a table one by one.

DECLARE @NewID INT

This one is inserting a new surveyID, Output is SurveyID

insert into survey(title,description, surveystatus,CreatedBy,date )
values('New Survey','New Survey',1,'test',Getdate())
SELECT @NewID = SCOPE_IDENTITY()

Copying the questions with the new surveyID

INSERT SurveyQuestions(surveyid, questions,answertype)
SELECT @NewID ,questions,answertype
FROM SurveyQuestions
WHERE surveyid='81'

The problem is below here. I want to get the value of the questionId of the
first select statement then the value of the questionID of the second select
statement and insert into the table SurveyChoices one by one.
Both the select statements can have 1 or 2 or 3 rows or more but the both the
select statements will have exact number of rows.

select QuestionId from surveyquestions where surveyid=@NewID and answertype
<> 'T'

select QuestionId from surveyquestions where surveyid='81' and answertype <>
'T'

Here i am using the insert statement using the value form First select
statement and second select statement


INSERT Surveychoices(QuestionId,choice)
SELECT questionID,choice((This is the value of the First select statement.)
FROM Surveychoices
WHERE questionid=questionID(This is the value of the second select statement.)
QuestionConversion error in ms sql Pin
seeism3-Aug-10 22:43
seeism3-Aug-10 22:43 
AnswerRe: Conversion error in ms sql Pin
seeism3-Aug-10 23:19
seeism3-Aug-10 23:19 
QuestionMultiple Database Transaction Pin
dataminers3-Aug-10 21:46
dataminers3-Aug-10 21:46 
AnswerRe: Multiple Database Transaction [modified] Pin
Mrityunnjoy6-Aug-10 9:19
Mrityunnjoy6-Aug-10 9:19 
QuestionNew column retrival on Sql Pin
<<Tash18>>3-Aug-10 21:13
<<Tash18>>3-Aug-10 21:13 
AnswerRe: New column retrival on Sql Pin
Goutam Patra3-Aug-10 21:58
professionalGoutam Patra3-Aug-10 21:58 
GeneralRe: New column retrival on Sql Pin
<<Tash18>>3-Aug-10 22:12
<<Tash18>>3-Aug-10 22:12 
QuestionSanity Check : Anyone doing Linq to SQL under 4.0 framework and WCF? Pin
Michael Eber3-Aug-10 13:27
Michael Eber3-Aug-10 13:27 
QuestionA Secured Hotel Management System using Visual BAsic 2010 Pin
prog_mafia3-Aug-10 4:20
prog_mafia3-Aug-10 4:20 
AnswerRe: A Secured Hotel Management System using Visual BAsic 2010 Pin
J4amieC3-Aug-10 4:43
J4amieC3-Aug-10 4:43 
GeneralRe: A Secured Hotel Management System using Visual BAsic 2010 Pin
Jason Vetter3-Aug-10 5:21
Jason Vetter3-Aug-10 5:21 
GeneralRe: A Secured Hotel Management System using Visual BAsic 2010 Pin
Simon_Whale3-Aug-10 5:29
Simon_Whale3-Aug-10 5:29 
GeneralRe: A Secured Hotel Management System using Visual BAsic 2010 Pin
hairy_hats3-Aug-10 5:37
hairy_hats3-Aug-10 5:37 
GeneralRe: A Secured Hotel Management System using Visual BAsic 2010 Pin
J4amieC3-Aug-10 6:02
J4amieC3-Aug-10 6:02 
GeneralRe: A Secured Hotel Management System using Visual BAsic 2010 Pin
Simon_Whale3-Aug-10 6:05
Simon_Whale3-Aug-10 6:05 
AnswerRe: A Secured Hotel Management System using Visual BAsic 2010 Pin
Simon_Whale3-Aug-10 5:28
Simon_Whale3-Aug-10 5:28 
AnswerRe: A Secured Hotel Management System using Visual BAsic 2010 PinPopular
dan!sh 3-Aug-10 5:29
professional dan!sh 3-Aug-10 5:29 

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.