Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SQL
from StoredProcedureParameter parameter in                                        svr.Databases[""].StoredProcedures[""].Parameters
where !string.IsNullOrEmpty(parameter.DefaultValue)
select parameter.Name


Don't work.
Posted
Comments
John C Rayan 12-Feb-15 4:36am    
HiCan you please explain with more details?
andrey91 12-Feb-15 6:37am    
Hello. there is a procedure

CREATE PROCEDURE [dbo].[Proc]
@Param1 VARCHAR(50),
@Param2 INT = 111,
@Param3 VARCHAR(30) = NULL
AS
BEGIN
SET NOCOUNT ON

END
Param2 set by default.
I want to get the value Param2.
John C Rayan 12-Feb-15 7:02am    
If the parameter is not defined as output param , then I doubt you could do it from application code.
andrey91 12-Feb-15 7:17am    
var conn = new SqlConnection("ConnectionString";");
conn.Open();
Server srv = new Server(new ServerConnection(conn));

srv.ConnectionContext.Connect();

Database db = srv.Databases["DATABASE"];
foreach (StoredProcedureParameter param in db.StoredProcedures["PROCNAME"].Parameters)
{
string paramName = param.Name;
var dataType = param.DataType;
object defaultValue = param.DefaultValue;
}
param.DefaultValue always equal ""

1 solution

 
Share this answer
 
Comments
andrey91 12-Feb-15 6:32am    
Thank U. I would like to do just means .NET Framework

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900