Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 20th, 2006, 06:12 PM
Authorized User
 
Join Date: Apr 2006
Posts: 79
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via AIM to anujrathi Send a message via MSN to anujrathi Send a message via Yahoo to anujrathi
Default SELECT...CASE in stored procedures

Hi friends,

I m writing some stored procedures.

Pls tell me, how can we use IF..ELSE, nested IF..ELSE in stored procedure. means i want to pass a int parameter to stored procedure & according to this value, we will execute my queries.

eg if i=1 then insert, if i=2 then update or if i=3 then update. Also i can choose different SELECT statement according to i.

Now how can i use the SELECT....CASE in stored procedure. means same above thing i want to do with SELECT....CASE. For example, for case 1, i want to write insert statement, for case 2 update statement & for case 3 delete statement.

pls give details
 
Old June 21st, 2006, 04:57 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by anujrathi
 Hi friends,

I m writing some stored procedures.

Pls tell me, how can we use IF..ELSE, nested IF..ELSE in stored procedure. means i want to pass a int parameter to stored procedure & according to this value, we will execute my queries.

eg if i=1 then insert, if i=2 then update or if i=3 then update. Also i can choose different SELECT statement according to i.

Now how can i use the SELECT....CASE in stored procedure. means same above thing i want to do with SELECT....CASE. For example, for case 1, i want to write insert statement, for case 2 update statement & for case 3 delete statement.

pls give details
IF CaseValue = 1
  INSERT ..
IF CaseValue = 2
  UPDATE ...
IF CaseValue = 3
  DELETE ...






Similar Threads
Thread Thread Starter Forum Replies Last Post
select case bacster Classic ASP Basics 2 May 1st, 2006 06:31 PM
Select Case junaidraja30 Access VBA 1 February 5th, 2005 08:30 PM
select case yuvalk SQL Server 2000 4 August 25th, 2004 02:33 PM
Select Case morpheus VB How-To 1 August 13th, 2003 09:14 AM
Select Case ziwez0 .NET Web Services 8 July 11th, 2003 02:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.