Click here to Skip to main content
16,005,181 members
Home / Discussions / Database
   

Database

 
GeneralRe: Please help totally lost on syntax Pin
Michael Potter24-Mar-06 4:50
Michael Potter24-Mar-06 4:50 
GeneralRe: Please help totally lost on syntax Pin
MeterMan24-Mar-06 4:43
MeterMan24-Mar-06 4:43 
GeneralRe: Please help totally lost on syntax Pin
Michael Potter24-Mar-06 4:52
Michael Potter24-Mar-06 4:52 
GeneralRe: Please help totally lost on syntax Pin
MeterMan24-Mar-06 6:25
MeterMan24-Mar-06 6:25 
GeneralRe: Please help totally lost on syntax Pin
Michael Potter24-Mar-06 8:39
Michael Potter24-Mar-06 8:39 
GeneralRe: Please help totally lost on syntax Pin
MeterMan25-Mar-06 12:43
MeterMan25-Mar-06 12:43 
QuestionDelete Procedure Pin
shapper24-Mar-06 3:28
shapper24-Mar-06 3:28 
AnswerRe: Delete Procedure Pin
Michael Potter24-Mar-06 4:10
Michael Potter24-Mar-06 4:10 
You could just implement Cascade on Delete when you implement referencial integrity. But, I always do it the hard way also:

ALTER PROCEDURE [dbo].[Surveys_DeleteSurvey]
(
    @SurveyId As uniqueidentifier
)
AS
BEGIN
    
    -- Check if SurveyId is null
    IF( @SurveyId IS NULL )
        RETURN -1
    ELSE
    BEGIN
        -- Return '-1' if a survey with SurveyId given value is not found
        IF( NOT EXISTS( SELECT @SurveyId FROM dbo.Surveys WHERE @SurveyId = SurveyId ) )
            RETURN -1
    END
    
    -- Delete Answers
    DELETE FROM 
        dbo.Answers 
    WHERE 
        SurveyQuestionId IN (SELECT 
                                SurveyQuestionId 
                             FROM 
                                Questions 
                             WHERE
                                SurveyId = @SurveyId)
    
    -- Delete Questions
    DELETE FROM 
        QUestions
    WHERE 
        SurveyId = @SurveyId
    
    -- Delete the survey with SurveyId given value
    DELETE FROM dbo.Surveys WHERE @SurveyId = SurveyId
     
    -- Return '0' when successful
    RETURN 0
END

QuestionSQL Server over Virtual Private Network Pin
StyleGuide24-Mar-06 0:08
StyleGuide24-Mar-06 0:08 
AnswerRe: SQL Server over Virtual Private Network Pin
Luis Alonso Ramos24-Mar-06 5:45
Luis Alonso Ramos24-Mar-06 5:45 
GeneralRe: SQL Server over Virtual Private Network Pin
StyleGuide26-Mar-06 6:21
StyleGuide26-Mar-06 6:21 
GeneralRe: SQL Server over Virtual Private Network Pin
Luis Alonso Ramos26-Mar-06 17:47
Luis Alonso Ramos26-Mar-06 17:47 
QuestionLogin ID and Password Pin
mrkeivan23-Mar-06 11:00
mrkeivan23-Mar-06 11:00 
AnswerRe: Login ID and Password Pin
Krisky23-Mar-06 17:39
Krisky23-Mar-06 17:39 
AnswerHEY i did what you said Pin
mrkeivan23-Mar-06 23:21
mrkeivan23-Mar-06 23:21 
AnswerRe: Login ID and Password Pin
Michael Potter24-Mar-06 4:36
Michael Potter24-Mar-06 4:36 
AnswerRe: Login ID and Password Pin
Luis Alonso Ramos26-Mar-06 17:49
Luis Alonso Ramos26-Mar-06 17:49 
QuestionVisio Pin
devfendar23-Mar-06 7:43
devfendar23-Mar-06 7:43 
QuestionQuery the MaxLocksPerFile Count. Pin
beatle1123-Mar-06 3:45
beatle1123-Mar-06 3:45 
QuestionTransfer sql server database to ms access in vb 6.0... Pin
swirldan23-Mar-06 1:04
swirldan23-Mar-06 1:04 
Questionwhat is wrong in this code Pin
mm31022-Mar-06 23:03
mm31022-Mar-06 23:03 
AnswerRe: what is wrong in this code Pin
albCode22-Mar-06 23:31
albCode22-Mar-06 23:31 
AnswerRe: what is wrong in this code Pin
Colin Angus Mackay23-Mar-06 1:34
Colin Angus Mackay23-Mar-06 1:34 
QuestionUnable to run the SQL Server critical update Pin
Suj_7822-Mar-06 23:03
Suj_7822-Mar-06 23:03 
AnswerRe: Unable to run the SQL Server critical update Pin
André Ziegler23-Mar-06 22:32
André Ziegler23-Mar-06 22:32 

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.