.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Sharon Maxwell
Post New Web Links

Not working a stored procedure executing in vb net instead of running it via sqlcmd

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :
 

I created a tored procedure which runs perfect using sqlcmd command, it works also using "Step Into stored procedure" from sserver explorer using Visual studio net. But when i execute this procedure using "ExecuteNonQuery" it doesn't work. Does anyone has any idea why is that?

Thanks for help


pp


View Complete Post


More Related Resource Links

Executing a job from a stored procedure stopped working

  
I've got a stored procedure in database A that calls the sp_start_job stored procedure in msdb as follows:   CREATE PROCEDURE xxxxx WITH EXECUTE AS 'domain\username'   AS   EXEC msdb.dbo.sp_start_job B'jobname' ;   RETURN   The domain\username is the in the database sysadmin role and the owner of the job.  To make this work originally, I had to change the msdb database to be trusted.   This worked for the past several months.   Now it doesn't work (perhaps after a reboot but not sure).  The error I get is "The EXECUTE permission was denied on the object 'sp_start_job', database 'msdb', schema 'dbo'   I looked to make sure that the account had grant execute rights and it does.  I tried setting it via GRANT statement and it was granted successfully yet the error still occurs.  I've tried changing accounts and anything else I can think of to no avail.   Any ideas how to troubleshoot this issue.  I've tried all the tricks I can think of.   Thanks - SM

Using the BDC API how to catch the returned code when executing a stored procedure?

  
using BDC API, how can i catch the return code a stored procedure returns?

I tried Entity.Execute to execute a generic method. However, it returns an empty Entity table.

I know you can do it by setting up an output variable. I prefer returning an integer for tracking errors.

Any ideas?

Thanks,

Guangming

Error Executing CLR Stored Procedure "Item has already been added. Key in dictionary"

  
Hello, I'm consuming a web service through assemblies in a Sql Server 2005 database. The client was made with VB.net 2005. Everything was fine in the deploy phase but once I compile the assembly generated in my sql server database and try to execute the CLR stored procedure defined in the assembly it crashes throwing the following error: Error: There was an error generating the XML document. Inner Exception: Item has already been added. Key in dictionary: 'SqlCifin.InfoComercial.ParametrosConsultaDTO' Key being added: 'SqlCifin.InfoComercial.ParametrosConsultaDTO' Where SqlCifin is the name of the assembly, InfoComercial is the web reference namespace and ParametrosConsultaDTO is a complex type defined in the WSDL to encapsulate the request parameters. I tried almost everything but nothing seems to work: Already checked the enviroment variables and . I would appreciate any help you can provide me.  PD: I'm using WSE 3.0. Thanks, Andres Diab.

Executing an SSIS package from an stored procedure and passing a parameter to it:

  
Hello all, I'm trying to execute an SSIS package from an stored procedure, using xp_cmdshell. When I execute the package, hard coding the value on the variable, I get rows inserted to my destination tables, which indicates my package pulled the correct data based on the TransactionID parameter. When I execute the package from the stored procedure, the package executes without issues, but I get no rows inserted into my destination tables, which leads me to think it is a data type issue, between the package and the variables I'm using within the stored procedure. The variable TransactionID on the SSIS package, is a string data type, therefore I'm passing it as a varchar from the stored procedure. Am I doing this correctly? Maybe I'm missing something, can you guys see anything wrong? Also, I tried login into the server and executing these 2 commands on the cmd prompt: One with "" quotes between the TransactionID value: dtexec /FILE "D:\SSISPackages\MyOrderCheckProcess\MyOrderCheck_RenewalOrder.dtsx" /CONFIGFILE "D:\SSISPackages\MyOrderCheckProcess\MyOrderCheckProcess_Config.dtsConfig" /CHECKPOINTING OFF  /REPORTING EWCDI  /SET \Package.Variables[User::TransactionID].Properties[Value];"470219"   And also one without quotes between the TransactionID value: dtexec /FILE "D:\SSISPackages\MyOrderCheckProcess\MyOrde

Had working Stored Procedure for years and broke all of sudden

  
I had a stored procedure that used a simple cursor to do a query against a linked SQL 2005 database.  It worked for years and failed out of the blue a month ago and the only way to fix it was to modify the cursor declaration to make it INSENSITIVE.  Any ideas why this would be?  No data is modified on the linked DB, just the local DB.  Seems weird this worked for years up until mid-august.  All SPs with cursors that were not local had to be modified to be INSENSITIVE.   Thanks Henry    MVP WanneBe

Error while executing SSIS package from a Stored Procedure

  

I am getting an error while executing a SSIS Package from SQL Server Stored Procedure.  But when I run it in BIDS, it executes successfully. Any help on this ???

SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occured.  Error Code: 0x80040ED. An OLE DB record is available. Source "Microsoft OLE DB Provider for Oracle" Hresult 0x80040eD Description: "ORA-01017: invalid username/password; logon denied"


Can a stored procedure programmatically determine if an SSIS package is running?

  

Greetings,

If I have the 'ExecutionInstanceGUID' value for an SSIS package that I know was started, is there a way that a stored procedure can programmatically determine whether the SSIS package still is running?

Thanks -

BCB

 


executing stored procedure from different server

  

'Hi All,

If have two servers A and B.I have a stored procedure in server A.But i need to execute the Stored procedure from server B.

i have a job in server B, in the step of that job,it should be executing the stored procedure from Server A. how can we do this.there is no linked server.

Exec sp_prcLoadData (this is in server A,but i need to execute it from Server B.)

 

Thanks in Advance


executing stored procedure from different server

  

'Hi All,

If have two servers A and B.I have a stored procedure in server A.But i need to execute the Stored procedure from server B.

i have a job in server B, in the step of that job,it should be executing the stored procedure from Server A. how can we do this.there is no linked server.

Exec sp_prcLoadData (this is in server A,but i need to execute it from Server B.)

 

Thanks in Advance


Stored Procedure Metadata failure- Dummy select not working

  

I have a procedure that involves creation of temp table, inserting data into it and use this data to populate another table variable whose output forms the dataset for the OLE DB Source.

Here is the general outlay of the procedure (just a sample data) -

CREATE PROCEDURE GetSettlementData
AS
BEGIN
SET NOCOUNT ON
SET FMTONLY OFF

IF 1=0
BEGIN
SELECT 
		CAST(NULL AS INT) AS ID
		,CAST(NULL AS INT) AS Marks
END

CREATE TABLE #Tmp_GetData
(
	ID INT,
	MARKS 

Running SSIS package from Stored Procedure using dtexec and Pass boolean value

  

Hi,

We are using SSIS 2005 and sql server 2005. My package has a boolean type package level variable. Eg: IsClientNull boolean type.

I call this package from stored procedure. In addition to passing values for other parameters, how can I pass boolean value.

My code is like this:

SET @CMD='dtexec ' +
'/FILE ' + @pShareName + @pPackageName + ' ' +
'/MAXCONCURRENT " -1 " ' +
'/CHECKPOINTING OFF ' +
'/REPORTING EW ' +
'/SET "\Package.Variables[User::StartDate].Properties[Value]";' +
CONVERT(char(10), @pStartDate, 120) + ' ' +
'/SET "\Package.Variables[User::EndDate].Properties[Value]";' +
CONVERT(char(10), @pEndDate, 120)
IF (@pClient IS NULL)
BEGIN

 SET @CMD = @CMD + ' ' +
 '/SET "\Package.Variables[User::IsClientNull].Properties[Value]";' +
 'True%


Unexpected Error when running large stored procedure report in SharePoint

  

I have a report which uses a stored procedure to retreive a resource intensive dataset from a Data Warehouse.  With a small scope it renders in SharePoint no problem, but when a larger scope is specified ShrePoint throws this non-descript error. 

I can execute the procedure in SQL Server Management Studio, and though it takes 2+ minutes with the larger scope (30 sec with smaller) it does return the data.  Similarly, in Business Intelligence Development Studio it returns the rendered report with data after 2-3 minutes.

Only in SharePoint and only with a larger dataset does this occur.  Timeout is set at 30 minutes and it occurs long before then.  SSRS server has over 12 gigs memory, running SQL Server 2008, SharePoint 2007 is in integrated mode. No errors in SharePoint server or SSRS server logs.  Ideas?


Unexpected Error when running large stored procedure report in SharePoint

  

I have a report which uses a stored procedure to retreive a resource intensive dataset from a Data Warehouse.  With a small report it renders in SharePoint no problem, but when a larger scope is specified ShrePoint throws this non-descript error. 

I can execute the procedure in SQL Server Management Studio, and though it takes 2+ minutes with the larger scope (30 sec with smaller) it does return the data.  Similarly, in Business Intelligence Development Studio it returns the rendered report with data after 2-3 minutes.

Only in SharePoint and only with a larger dataset does this occur.  Timeout is set at 30 minutes and it occurs long before then.  SSRS server has over 12 gigs memory, running SQL Server 2008, SharePoint 2007 is in integrated mode. No errors in SharePoint server or SSRS server logs.  Ideas?



-Erik

Executing a SSIS pkg from a stored procedure

  

HI.

I have a SSIS 2005 pkg and I want to launch it into a loop inside a stored procedure in SQL Server 2005.

Is it possible, please? How? Many thanks


Get same result when running MDX in stored procedure and Analysis Services

  

I have a simple MDX query as follows:

select non empty {descendants([dim fund].[fund structure].&[1])} on rows,
[measures].[amount] on columns
FROM [xyz]

When it runs against Analysis Services, it returns two columns:

All Funds        123,435,567
Fund1            122,400,090
SubFund1      6,445,435
SubFund2      546,343


When it runs it in a stored procedure with Openquery, it returns multiple columns to represent the structure:

create procedure usp_OLAPtest
AS
declare @strMDX_Sql as nvarchar(max)

set @strMDX_Sql = 'select non empty {descendants([dim fund].[fund structure].&[1])} on rows,
[measures].[amount] on columns FROM [xyz]'

exec (N'select * from openquery(xyz_OLAP, ''' + @strMDX_Sql + '''); '
)


All Funds  NULL    NULL          123,435,567
All Funds  Fund1   NULL          122,400,090
All Funds  Fund1   SubFund1   6,445,435
ALL Funds  Fund1   SubFund2   546,343


Is there any way for the stored proce

Stored Procedure stopped working in Visual Studio 2010; System.Data.SqlClient disabled?

  

Hi,

In Visual Studio 2010, I have a webform, with a button that attempts to manipulate a SQL table that has a lot of data (several years & archives of 12 people's emails: emailID, bodies, to, cc, bcc, date/time).  Problem has always been that with so many emails (500,000), I had to break up the manipulation jobs a bit, or VisualStudio/ASP.Net development server would freeze up running those SQL stored procedures.

So I determined, for each (.pst) email store, a unique series that was in each emailID - for instance, person A would have 00000195195xxxxx as their emailIDs, and person B would have 00000123456xxxxxx as their email IDs - and used those 30 [or so] identifying flags to recursively call a function that until yesterday was running my SQL stored procedures just fine. 

YEsterday, while that was running, for giggles, I rebuilt the index on my table, and freaked out the development server by accident.  I had to rollback the database using SQL Server Management Studio, or the database was "Suspect".

Now, my SQL Stored Procedure in that recursively called function won't run, despite the fact that the original SQL Query [that gets the identifying flags into a Datatable, and runs the sproc on each "row"] works just fine.

I think it's a setting, to protect me ... but can't

Stored Procedure stopped working in Visual Studio 2010; System.Data.SqlClient disabled?

  

Hi,

In Visual Studio 2010, I have a webform, with a button that attempts to manipulate a SQL table that has a lot of data (several years & archives of 12 people's emails: emailID, bodies, to, cc, bcc, date/time).  Problem has always been that with so many emails (500,000), I had to break up the manipulation jobs a bit, or VisualStudio/ASP.Net development server would freeze up running those SQL stored procedures.

So I determined, for each (.pst) email store, a unique series that was in each emailID - for instance, person A would have 00000195195xxxxx as their emailIDs, and person B would have 00000123456xxxxxx as their email IDs - and used those 30 [or so] identifying flags to recursively call a function that until yesterday was running my SQL stored procedures just fine. 

YEsterday, while that was running, for giggles, I rebuilt the index on my table, and freaked out the development server by accident.  I had to rollback the database using SQL Server Management Studio, or the database was "Suspect".

Now, my SQL Stored Procedure in that recursively called function won't run, despite the fact that the original SQL Query [that gets the identifying flags into a Datatable, and runs the sproc on each "row"] works just fine.

I think it's a setting, to protect me ... but can't

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend