| | |
stored procedure problem
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
Hi
i am passing three parameters to my stored procedure.
now in stored procedure i want to execute the query on the basis of given condition.
suppose i m passing para1, para2 and para3.
now i want update table1
if(para1='' or para1= null) then
'update table1 set para2='''+@para2+''' and para3='''+@para3+''''
else
'update table1 set para1='''+@para1+''' and para2='''+@para2+''' and para3='''+@para3+''' '
how can i do this???
please help...
Thanks in advance
i am passing three parameters to my stored procedure.
now in stored procedure i want to execute the query on the basis of given condition.
suppose i m passing para1, para2 and para3.
now i want update table1
if(para1='' or para1= null) then
'update table1 set para2='''+@para2+''' and para3='''+@para3+''''
else
'update table1 set para1='''+@para1+''' and para2='''+@para2+''' and para3='''+@para3+''' '
how can i do this???
please help...
Thanks in advance
Thanks & Regards
Umang
Umang
•
•
Join Date: Feb 2008
Posts: 1
Reputation:
Solved Threads: 0
Hi u4umang2001,
Right now I don't have near to me sample code, but could you take a look at Dynamic SQL?
See the following URL: http://msdn2.microsoft.com/en-us/library/aa258848.aspx
Hope this helps,
FeJoMeFa
Right now I don't have near to me sample code, but could you take a look at Dynamic SQL?
See the following URL: http://msdn2.microsoft.com/en-us/library/aa258848.aspx
Hope this helps,
FeJoMeFa
•
•
Join Date: Feb 2008
Posts: 30
Reputation:
Solved Threads: 4
hi u4umang2001,
Your query is little bit simple but you should try first using various article. These articles can be easily found using Google. If you want to learn things, you should try atleast once.
Following is solution for your query.
Hope this will help you. Don't rely on others, first try yourself if not possible then ask for solution.
Thanks & Regards
Dilip Kumar Vishwakarma
Programmer
.Net Consulting
•
•
•
•
if(para1='' or para1= null) then
'update table1 set para2='''+@para2+''' and para3='''+@para3+''''
else
'update table1 set para1='''+@para1+''' and para2='''+@para2+''' and para3='''+@para3+''' '
Following is solution for your query.
ASP.NET Syntax (Toggle Plain Text)
CREATE PROCEDURE sp_myStoredProcedure @para1 varchar(100), @para2 varchar(100), @para3 varchar(100) AS if @para1 IS NULL update table1 set para2=@para2 and para3=@para3 else update table1 set para1=@para1 And para2=@para2 And para3=@para3 Go
Hope this will help you. Don't rely on others, first try yourself if not possible then ask for solution.
Thanks & Regards
Dilip Kumar Vishwakarma
Programmer
.Net Consulting
![]() |
Similar Threads
- PHP and MySQL Stored Procedure Exec Problem (PHP)
- How to connect a SQL stored procedure to a windows application? (VB.NET)
- Pbm with stored procedure (Oracle)
- Can return a Stored Procedure Recordset (MS SQL)
- how do I run a "disconnected" stored procedure (MS SQL)
- grouping unique name in table (MS SQL)
- STORED PROCEDURE in .NET please help... (Oracle)
- Stored procedure call with ADO (C)
Other Threads in the ASP.NET Forum
- Previous Thread: datatype TEXT in stored procedure
- Next Thread: Temporary Web Page problem
| Thread Tools | Search this Thread |
.net 3.5 ajax alltypeofvideos appliances asp asp.net bc30451 beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions control countryselector dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol expose fileuploader fill findcontrol flash formatdecimal formview gridview gudi iis javascript list listbox login microsoft mouse mssql nameisnotdeclared news novell numerical opera panelmasterpagebuttoncontrols problem radio redirect registration relationaldatabases reportemail save schoolproject search security sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visualstudio vs2008 web webapplications webdevelopemnt webdevelopment webprogramming webservice wizard xsl youareanotmemberofthedebuggerusers





