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

Database

 
QuestionDbf.Net Pin
Pascal Ganaye11-Jun-09 13:44
Pascal Ganaye11-Jun-09 13:44 
QuestionDiagram Database. Pin
VisualLive11-Jun-09 7:25
VisualLive11-Jun-09 7:25 
AnswerRe: Diagram Database. Pin
AlexeiXX311-Jun-09 14:42
AlexeiXX311-Jun-09 14:42 
JokeRe: Diagram Database. Pin
VisualLive11-Jun-09 15:33
VisualLive11-Jun-09 15:33 
GeneralRe: Diagram Database. Pin
AlexeiXX311-Jun-09 19:07
AlexeiXX311-Jun-09 19:07 
JokeRe: Diagram Database. Pin
AlexeiXX311-Jun-09 14:43
AlexeiXX311-Jun-09 14:43 
GeneralRe: Diagram Database. Pin
Mycroft Holmes11-Jun-09 22:25
professionalMycroft Holmes11-Jun-09 22:25 
QuestionSQL2005 Stored Procedure Conditional Statement Pin
munklefish11-Jun-09 5:07
munklefish11-Jun-09 5:07 
Hi,

Im still fairly new to stored procedures but have reached a point where i need to use a conditional statement. At present i have to code below which will not compile due to various errors.
Please can you help me understand how i can make this work. Thanks;

CREATE PROCEDURE web.InsertManualAddressBook
          (
          @tmp_custID bigint
          )
AS
BEGIN
   IF EXISTS (SELECT * FROM tbl_AddressBookMaster WHERE addMaster_UserId = @tmp_custID AND addMaster_Title = 'Default')=1
       SELECT * FROM tbl_AddressBookMaster WHERE addMaster_UserId = @tmp_custID
       DELETE FROM tbl_AddressBookAddresses WHERE tbl_AddressBookAddresses.adds_ABMId = tbl_AddressBookMaster.addMaster_Key;
   ELSE
         'Do something else
END


Essentially what i want to do is;

1)Check if a record exists based on the input @tmp_custID(bigint) value.

2)If a record exists check a second table for records where the 'addMaster_UserID' column matches the 'addMaster_Key' of the initial table queried. Delete this records.

3)If the condition in item 1 isnt met, do something else.


Any help is correcting the above statement would be really appreciated.

Thanks.
AnswerRe: SQL2005 Stored Procedure Conditional Statement Pin
Rob Philpott11-Jun-09 6:16
Rob Philpott11-Jun-09 6:16 
GeneralRe: SQL2005 Stored Procedure Conditional Statement Pin
munklefish11-Jun-09 6:47
munklefish11-Jun-09 6:47 
GeneralRe: SQL2005 Stored Procedure Conditional Statement Pin
munklefish11-Jun-09 23:44
munklefish11-Jun-09 23:44 
GeneralRe: SQL2005 Stored Procedure Conditional Statement Pin
munklefish11-Jun-09 23:48
munklefish11-Jun-09 23:48 
GeneralRe: SQL2005 Stored Procedure Conditional Statement Pin
Rob Philpott12-Jun-09 1:55
Rob Philpott12-Jun-09 1:55 
GeneralRe: SQL2005 Stored Procedure Conditional Statement Pin
munklefish12-Jun-09 2:00
munklefish12-Jun-09 2:00 
GeneralRe: SQL2005 Stored Procedure Conditional Statement Pin
munklefish12-Jun-09 4:06
munklefish12-Jun-09 4:06 
QuestionHelp with the Following SQl SP Pin
Vimalsoft(Pty) Ltd11-Jun-09 0:15
professionalVimalsoft(Pty) Ltd11-Jun-09 0:15 
AnswerRe: Help with the Following SQl SP Pin
Rob Philpott11-Jun-09 6:21
Rob Philpott11-Jun-09 6:21 
AnswerRe: Help with the Following SQl SP Pin
Mycroft Holmes11-Jun-09 22:33
professionalMycroft Holmes11-Jun-09 22:33 
QuestionHow to schedule a job in SQL Server 2005? Pin
gunjan.mits11-Jun-09 0:11
gunjan.mits11-Jun-09 0:11 
AnswerRe: How to schedule a job in SQL Server 2005? Pin
Robin_Roy11-Jun-09 1:01
Robin_Roy11-Jun-09 1:01 
AnswerRe: How to schedule a job in SQL Server 2005? Pin
Jerry Hammond11-Jun-09 4:26
Jerry Hammond11-Jun-09 4:26 
QuestionScalar / Navigation properties? Pin
pankazmittal10-Jun-09 7:48
pankazmittal10-Jun-09 7:48 
AnswerRe: Scalar / Navigation properties? Pin
saanj10-Jun-09 23:34
saanj10-Jun-09 23:34 
AnswerRe: Scalar / Navigation properties? Pin
Niladri_Biswas17-Jun-09 20:58
Niladri_Biswas17-Jun-09 20:58 
GeneralRe: Scalar / Navigation properties? Pin
pankazmittal18-Jun-09 3:30
pankazmittal18-Jun-09 3:30 

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.