Procedure or function !!! has too many arguments specified
You invoke the function with 2 parameters (@GenId and @Description):
EXEC etl.etl_M_Update_Promo @GenID, @Description
However you have declared the function to take 1 argument:
ALTER PROCEDURE [etl].[etl_M_Update_Promo]
@GenId bigint = 0
SQL Server is telling you that [etl_M_Update_Promo]
only takes 1 parameter (@GenId
)
You can alter the procedure to take two parameters by specifying @Description
.
ALTER PROCEDURE [etl].[etl_M_Update_Promo]
@GenId bigint = 0,
@Description NVARCHAR(50)
AS
.... Rest of your code.
Procedure or function has too many argument specified
Your Procedure UploadToDatabase has 5 parameter defined,but in designer.cs you have 6 parameter including rcout. You can change your procedure to have rcout as a parameter or output parameter if you are using it as output parameter.
ALTER PROCEDURE [dbo].[UploadToDatabase]
@UserId bigint,
@ClientMachineIP nvarchar(15),
@LoadType nvarchar(25) ='Upload',
@InstId bigint = null,
@bIsIgnoreErrors bit = 'False',
@rcout int OUTPUT
AS
BEGIN
SET NOCOUNT ON;
declare @srcConnection varchar(MAX)
set @srcConnection = 'Data Source=PAth Of my .mdb file;Provider=Microsoft.Jet.OLEDB.4.0;'
declare @ssispath varchar(1000)
declare @cmd varchar(1000)
set @ssispath = 'Package Path\Package.dtsx'
set @cmd = @cmd + 'Package.Variables["SourceConnectionString"].Value = @srcConnection'
set @cmd = 'dtexec /F "' + @ssispath + '"'
print @cmd
exec master..xp_cmdshell @cmd
Select @rcout= @@ROWCOUNT
Procedure or function has too many arguments specified #2
You are specifying arguments that the stored procedure isn't expecting.
Remove any arguments that aren't defined by the stored procedure
Make sure that every parameter in the block
objDL.Addparam("@Createdby", Createdby);
objDL.Addparam("@Createddate", Createddate);
objDL.Addparam("@Sitecode", NO);
objDL.Addparam("@Itemtype", Itemtype);
objDL.Addparam("@Status", Status);
objDL.Addparam("@Maingroupsno", Mainidentify);
objDL.Addparam("@Subgroupsno", Identification);
objDL.Addparam("@Componetcode",NAME);
objDL.Addparam("@Sitename", Sitename);
has a corresponding parameter in the stored procedure. Remove any parameter that isn't defined in the procedure
Procedure or function has too many arguments specified
You are using same SqlCommnad object
for multiple insertions so previously
added parameters
are also present.
So either create a new SqlCommnad object
inside loop or clear
prevoius parameters.
This is how you can Clear
Previously added parameters.
cmdS.Parameters.Clear();
How to solve Procedure or function has too many arguments specified exception?
There are few things that you should try to investigate
Check the connection string to check it is hitting the right database
Try specifying the command type :
cmd.CommandType = System.Data.CommandType.StoredProcedure;
And change the parameter type you are passing in for the appNo from Varchar to Int.
cmd.Parameters.Add("@appNo", SqlDbType.VarChar).Value = appNo;
As per the stored proc, it should be int.
cmd.Parameters.Add("@appNo", SqlDbType.Int).Value = appNo;
Procedure or function has too many arguments specified in Logic App
Your stored procedure only accepts one parameter, it looks like you were changing from parsing the json in the stored procedure and the logic app and you now have a mixture that doesn't match up.
create procedure [dbo].[sp_Table]
(
@json varchar(max)
)
Procedure or function SP_InsertBookDetail has too many arguments specified
Not totally sure what you are trying to do here but you have a number of things in your code that are a bit left of center.
A couple of things you don't want to do.
- use a connection that is opened from somewhere else.
- Leave varchar parameters the default length
I would restructure this method to something more along these lines.
public int addRecord(BookInformation bookInfo, List<BookInformation> bookList)
{
try
{
using (SqlConnection conn = new SqlConnection("Your Connection String Here"))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand("SP_InsertBookHeader", conn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@BookID", SqlDbType.VarChar).Value = bookInfo.BookID;
cmd.Parameters.Add("@Copies", SqlDbType.Int).Value = bookInfo.Copies;
cmd.Parameters.Add("@Date", SqlDbType.DateTime).Value = bookInfo.Date;
cmd.ExecuteNonQuery();
}
using (SqlCommand cmdLine = new SqlCommand("SP_InsertBookDetail", conn))
{
cmdLine.CommandType = CommandType.StoredProcedure;
foreach (BookInformation items in bookList)
{
cmdLine.Parameters.Clear();
cmdLine.Parameters.Add("@BookID", SqlDbType.VarChar, 20).Value = items.BookID;
cmdLine.Parameters.Add("@ISBN", SqlDbType.VarChar, 50).Value = items.ISBN;
cmdLine.Parameters.Add("@Name", SqlDbType.VarChar, 100).Value = items.Name;
cmdLine.Parameters.Add("@Description", SqlDbType.VarChar, 10).Value = items.Description;
cmdLine.Parameters.Add("@PublishDate", SqlDbType.DateTime).Value = items.PublishDate;
cmdLine.Parameters.Add("@Language", SqlDbType.VarChar, 20).Value = items.Language;
cmdLine.Parameters.Add("@AuthorID", SqlDbType.VarChar, 20).Value = items.AuthorID;
cmdLine.Parameters.Add("@Category", SqlDbType.VarChar, 20).Value = items.Category;
cmdLine.Parameters.Add("@Edition", SqlDbType.Int).Value = items.Edition;
cmdLine.Parameters.Add("@Price", SqlDbType.Decimal, 18).Value = items.Price;
cmdLine.ExecuteNonQuery();
}
}
return bookList.Count; //not really sure what you want to return here
}
}
catch (Exception ex)
{
//Do something with your exceptions here.
//Log them in the database or an exception log
//report this back to the calling application or the user
}
}
Related Topics
Cross Join Without Duplicate Combinations
Script to Kill All Connections to a Database (More Than Restricted_User Rollback)
How to Get Other Columns When Using Spark Dataframe Groupby
Anonymous Table or Varray Type in Oracle
Sql, How to Concatenate Results
Why Doesn't SQL Support "= Null" Instead of "Is Null"
Differencebetween SQL, Pl-SQL and T-Sql
Selecting Top N Rows for Each Group in a Table
Renaming Foreign-Key Columns in MySQL
Oracle: Combine Multiple Results in a Subquery into a Single Comma-Separated Value
Best Database Field Type for a Url
Is There Auto Increment in SQLite
Name Database Design Notation You Prefer and Why
Get Month from Datetime in SQLite
MySQL #1140 - Mixing of Group Columns
Access 2010: Syntax Error (Missing Operator) in Query Expression