Senior & Expert .Net Developers Discussion Forum by Nyros Technologies

HIRE .Net Expert Developers Programmers Coders From India
Ruby on Rails PHP .Net Developers Community, Nyros Technologies, Kakinada
 
Log in  or IF not a member please REGISTER
Username:
Password:   


Keyword
Log in | Profile 

how to write if statement in sql server stored procedure.

 
Post new topic   Reply to topic    Senior & Expert .Net Developers Discussion Forum by Nyros Technologies Index -> ADO.Net
View previous topic :: View next topic  
Author Message
Marx



Joined: 02 Nov 2007
Posts: 9

PostPosted: Wed May 21, 2008 6:42 am    Post subject: how to write if statement in sql server stored procedure. Reply with quote

hi experts,
i have developed a web application using asp.net. in this my application is interacting with sql server database. for this i have to use stored procedures concept instead of dynamic queries for the sake of site performance. can any any one suggest me how to write a stored procedure with conditional statement to get data from my table.
thanking you in advance,


regards,
max
Back to top
View user's profile Send private message
deepak patel



Joined: 27 Aug 2007
Posts: 14

PostPosted: Wed May 21, 2008 7:04 am    Post subject: Reply with quote

hi max,

developing a web application with the help of stored procedure instead of dynamic stored procedure improved site performance. here is the sample stored procedure for selecting data from employees table by employeesId and getting all employees information with only one single stored procedure with the help of conditional statements.

Create PROCEDURE [dbo].sp_Select_Employees
@EmployeeId int,
@Option varchar(15)

as
begin
if(@Option ='All')
select * from employees
else
select * from employees where employeeId=@EmployeeId

end

here @Option is a variable which stores search information.

try this procedure...and enjoy the codding...keep doing postings...
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Senior & Expert .Net Developers Discussion Forum by Nyros Technologies Index -> ADO.Net
Page 1 of 1


 latest topics 
 Topics   Replies   Author   Views   Last Post 
No new posts How to Add Update Delete for gridview using Webservice
1 sanjay 31 Fri Sep 10, 2010 7:05 am
setty View latest post
No new posts Is there any free webhosts that support ASP.NET. ?
2 Balaji 634 Tue Sep 07, 2010 10:24 am
chrisadam View latest post
No new posts Hostings For ASP.NET 2.0 with SQL Server
2 Avash 676 Tue Sep 07, 2010 10:21 am
chrisadam View latest post
No new posts Exceptional Manger
1 suraj 51 Thu Sep 02, 2010 8:52 am
Rahul View latest post
No new posts background image for UITableView
0 kumar 55 Wed Sep 01, 2010 10:34 am
kumar View latest post
No new posts Types of Run time exceptions
1 Dheeraj 52 Wed Sep 01, 2010 8:58 am
venkat View latest post
No new posts Access Web Page content in Windows Forms without WebBrowser
3 mouli 273 Wed Sep 01, 2010 7:31 am
rajesh View latest post
No new posts Explain Interlocked Class & Daemon Thread's?
1 mukundh 76 Wed Sep 01, 2010 7:19 am
setty View latest post
No new posts Life Cycle Of Delegate
0 vinay 40 Wed Sep 01, 2010 7:14 am
vinay View latest post
No new posts Accessing methods defined in another page
1 suraj 37 Tue Aug 31, 2010 12:45 pm
Rahul View latest post




Hire an expert .Net developer / coder / programmer or development team from India now!!

Other Forums : Ruby on Rails   ::   PHP   |   Free unlimited HTML CSS templates download

Nyros Technologies   |   Kakinada City Portal   |   Developers Blog   |   About .Net Experts   |   More