Accessing Return From Sp_monitor

Sep 22, 2006

 When I run the stored procedure sp_monitor through VB I only
seem to be able to access the first 3 values returned, see code below.  When I run the stored procedure through the enterprise manager I can see about 13 returned values. The reader loop only seems to have one iteration, with 3 arguments, how do I access the others?


 
        cmd.CommandText = "sp_monitor"

        cmd.CommandType = CommandType.StoredProcedure

        reader = cmd.ExecuteReader()



        While reader.Read()

           
results.AppendLine(String.Format("{0}, {1}, {2}", reader.GetName(0),
reader.GetName(1), reader.GetName(2)))

           
results.AppendLine(String.Format("{0} {1} {2} {3}<br/>",
reader(0), reader(1), reader(2), ctr))

            ctr = ctr + 1

        End While

View 1 Replies


ADVERTISEMENT

Accessing The Return Variable Of An Insert

May 4, 2008

When I create a tableadapter to do an insert it added
SELECT EventDate, EventID, org_id, ROMEventID FROM ROMEvents WHERE (ROMEventID = SCOPE_IDENTITY())
at the end. This looks useful to me since it implies that I can access ROMEventID which is the auto-incremented identity field.
 How would I reference the variable in my .cs file?
My insert is working as ROMEventsTableAdapter ROMEventInsert = new ROMEventsTableAdapter();
ROMEventInsert.InsertIntoROMEvents(theDate, EventID, org_id);
Thanks for any help

View 2 Replies View Related

SP_Monitor Error

Dec 4, 2000

After running sp_monitor I got the follwoing errors, I have runned sp_dboption and also SET ANSI_Warning to OFF. The problem is still there therefore, I would be very glad if someone out there can help me out me.

Error Messages
Server: Msg 8115, Level 16, State 2, Procedure sp_monitor, Line 94
Arithmetic overflow error converting expression to data type int.

View 1 Replies View Related

Can We Use Stored Procedurem To Return Several Results (accessing SQL Server)

Jun 5, 2006

Can I use sqlDatareader with a stored procedure to return more than one reultset that I ll be accessing through MyDatareader.MoveNext
Any Little example on both the stored proc and the .Net side
Thanks

View 4 Replies View Related

SQL 2000 Stops To Increment @cpu_busy Value, Sp_monitor Does Not Work Anymore

Apr 29, 2006

1) After a couple of months of work SQL 2000 server stops to increment @@cpu_busy. If you query it you€™ll get a constant value as well as error:

select @@CPU_BUSY

Arithmetic overflow occurred.
134217727

2) If you execute sp_monitor you'll get nothing but errors:

Arithmetic overflow occurred.
Arithmetic overflow occurred.
Arithmetic overflow occurred.

This happens only on multiprocessor machines. SQL Service pack 3. The only way to fix it is to restart the SQL service. If you have a performance tool based on that value, like Idera's SQLdm- sorry, it will show zero.

Is there a fix from MS for that?

View 6 Replies View Related

Return Error Code (return Value) From A Stored Procedure Using A Sql Task

Feb 12, 2008


I have a package that I have been attempting to return a error code after the stored procedure executes, otherwise the package works great.

I call the stored procedure from a Execute SQL Task (execute Marketing_extract_history_load_test ?, ? OUTPUT)
The sql task rowset is set to NONE. It is a OLEB connection.

I have two parameters mapped:

tablename input varchar 0 (this variable is set earlier in a foreach loop) ADO.
returnvalue output long 1

I set the breakpoint and see the values change, but I have a OnFailure conditon set if it returns a failure. The failure is ignored and the package completes. No quite what I wanted.

The first part of the sp is below and I set the value @i and return.


CREATE procedure [dbo].[Marketing_extract_history_load_TEST]

@table_name varchar(200),

@i int output

as

Why is it not capturing and setting the error and execute my OnFailure code? I have tried setting one of my parameter mappings to returnvalue with no success.

View 2 Replies View Related

How To Return SqlDataReader And Return Value (page Count) From SPROC

Jan 2, 2006

This is my function, it returns SQLDataReader to DATALIST control. How
to return page number with the SQLDataReader set ? sql server 2005,
asp.net 2.0

    Function get_all_events() As SqlDataReader
        Dim myConnection As New
SqlConnection(ConfigurationManager.AppSettings("..........."))
        Dim myCommand As New SqlCommand("EVENTS_LIST_BY_REGION_ALL", myConnection)
        myCommand.CommandType = CommandType.StoredProcedure

        Dim parameterState As New SqlParameter("@State", SqlDbType.VarChar, 2)
        parameterState.Value = Request.Params("State")
        myCommand.Parameters.Add(parameterState)

        Dim parameterPagesize As New SqlParameter("@pagesize", SqlDbType.Int, 4)
        parameterPagesize.Value = 20
        myCommand.Parameters.Add(parameterPagesize)

        Dim parameterPagenum As New SqlParameter("@pageNum", SqlDbType.Int, 4)
        parameterPagenum.Value = pn1.SelectedPage
        myCommand.Parameters.Add(parameterPagenum)

        Dim parameterPageCount As New SqlParameter("@pagecount", SqlDbType.Int, 4)
        parameterPageCount.Direction = ParameterDirection.ReturnValue
        myCommand.Parameters.Add(parameterPageCount)

        myConnection.Open()
        'myCommand.ExecuteReader(CommandBehavior.CloseConnection)
        'pages = CType(myCommand.Parameters("@pagecount").Value, Integer)
        Return myCommand.ExecuteReader(CommandBehavior.CloseConnection)
    End Function

Variable Pages is global integer.

This is what i am calling
        DataList1.DataSource = get_all_events()
        DataList1.DataBind()

How to return records and also the return value of pagecount ? i tried many options, nothing work. Please help !!. I am struck

View 3 Replies View Related

'Return' Statement In A Function,Get,or Operator Must Return A Value....Question

Aug 28, 2007


I'm a Reporting Services New-Be.

I'm trying to create a report that's based on a SQL-2005 Stored Procedure.

I added the Report Designer, a Report dataset ( based on a shared datasource).

When I try to build the project in BIDS, I get an error. The error occurs three times, once for each parameter on the stored procedure.

I'll only reproduce one instance of the error for the sake of brevity.

[rsCompilerErrorInExpression] The Value expression for the query parameter 'UserID' contains an error : [BC30654] 'Return' statement in a Function, Get, or Operator must return a value.

I've searched on this error and it looks like it's a Visual Basic error :

http://msdn2.microsoft.com/en-us/library/8x403818(VS.80).aspx

My guess is that BIDS is creating some VB code behind the scenes for the report.

I can't find any other information that seems to fit this error.

The other reports in the BIDS project built successfully before I added this report, so it must be something specific to the report.

BTW, the Stored Procedure this report is based on a global temp table. The other reports do not use temp tables.

Can anyone help ?

Thanks,

View 5 Replies View Related

Using Output Clause And Return Timestamp And Return Value

Oct 28, 2006

I am trying to bring my stored proc's into the 21st century with try catch and the output clause. In the past I have returned info like the new timestamp, the new identity (if an insert sproc), username with output params and a return value as well. I have checked if error is a concurrency violation(I check if @@rowcount is 0 and if so my return value is a special number.)

I have used the old goto method for trapping errors committing or rolling back the transaction.

Now I want to use the try,catch with transactions. This is easy enough but how do I do what I had done before?

I get an error returning the new timestamp in the Output clause (tstamp is my timestamp field -- so I am using inserted.tstamp).

Plus how do I check for concerrency error. Is it the same as before and if so would the check of @@rowcount be in the catch section?

So how to return timestamp and a return value and how to check for concurrency all in the try/catch.

by the way I read that you could not return an identity in the output clause but I had no problem.

Thanks for help on this

SM haig

View 5 Replies View Related

Why SP Return SQLException When No Data Return ?

Jul 24, 2006

hi, good day,

i have using BCP to output SP return data into txt file, however, when it return nothing , it give SQLException like "no rows affected" , i have try to find out the solution , which include put "SET NOCOUNT ON" command before select statement, but it doesn't help :(

anyone know how to handle the problem when SP return no data ?

thanks in advance

View 1 Replies View Related

Transact SQL :: Return Set Of Values From SELECT As One Of Return Values From Stored Procedure

Aug 19, 2015

I have a stored procedure that selects the unique Name of an item from one table. 

SELECT DISTINCT ChainName from Chains

For each ChainName, there exists 0 or more StoreNames in the Stores. I want to return the result of this select as the second field in each row of the result set.

SELECT DISTINCT StoreName FROM Stores WHERE Stores.ChainName = ChainName

Each row of the result set returned by the stored procedure would contain:

ChainName, Array of StoreNames (or comma separated strings or whatever)

How can I code a stored procedure to do this?

View 17 Replies View Related

ASP.NET/C# Accessing A SQL DB

Sep 14, 2004

Good Morning,

I am wondering if anyone can help me/ Currently I have created an ASP.NET webform. Usingt the VS.NET C# IDE I have put a SQL connection and DataAdapter on the webform. I have then created a dataset which should hold the contents of a table on a SQL server db.

However when i run the page which just tries to fill the dataset i get the error below. I am running the page via IIS on WinXP Pro SP1 system and SQL Server is located on a Win2003 Svr.

Can anyone help?

Thanks & Regards,

Alan

Server Error in '/Quiz' Application.
--------------------------------------------------------------------------------

SQL Server does not exist or access denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.

Source Error:

Line 38: // Put user code to initialize the page here
Line 39:
Line 40: sqlConsumerDataAdapter.Fill(consumerDS11);
Line 41:

Source File: c:inetpubwwwrootquizwebform1.aspx.cs Line: 40

Stack Trace:

[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +484
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
System.Data.SqlClient.SqlConnection.Open() +384
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
Quiz.WebForm1.Page_Load(Object sender, EventArgs e) in c:inetpubwwwrootquizwebform1.aspx.cs:40
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

View 7 Replies View Related

Accessing URL

Oct 13, 2006

Hi!

I have two assets: a URL that points to an XML file, and a stored procedure that can accept this file as a text variable and store it in a SQL 2005 table.
create procedure [dbo].[insertObjects]
@availabilityXml text
as
DECLARE @xmlHndAdd INT
EXEC sp_xml_prepareDocument @xmlHndAdd OUTPUT, @availabilityXml
TRUNCATE TABLE Objects
INSERT Objects
SELECT *
FROM OPENXML(@xmlHndAdd, '//NewDataSet/Table1', 2)
WITH Objects

Now, I need to find a solution to combine the URL with the proc. Does anyone have any suggestions on how I can pass my URL as a text variable to the procedure? SSIS, vb-script, etc. are welcome!

Thank you!

View 5 Replies View Related

Accessing A DSN Through A Sql Job

Nov 13, 2006

I am trying to execute an SSIS package (which accesses a dbf file through an odbc connection) through a Sql job, but the package log reports an error of "Disk or netowrk error". When I execute the package in the IDE, the package executes fine. When I run the manifest on the DB server, I can execute the package with no errors. But, when I create the job, and try to execute the job, it fails. I thought at first that the user didn't have privileges to the directory that the file existed in, but that isn't the case.

Can anyone shed some light on how to accomplish what I am trying to accomplish? It seems like this would be a common use of SSIS, but I cannot seem to get it to work.

Thanks in advance for any assistance you can provide!

Craig

View 2 Replies View Related

Accessing Two Databases

Sep 16, 2006

Hi, I am developing a small asp.net  application where I read from a readonly omnis database via odbc then dependant on user input write records to a second database.My first idea was to use an odbc connection to Omnis database and write to ms sql database.  There is quite a few queries that need to be made to the Omnis database and I am binding a datagrid to the MS Sql server database.  I was hoping to use stored procedures to update the mssql tables.  So there will be much opening and closing of connections. Should I go down that road or should i think of using an Access database, with linked table to the Omnis database, then only one connection needs to be made.  And I can store my information in the Access database tables. Thanks.

View 3 Replies View Related

Remote Accessing

Dec 10, 2006

Hello,I just uploaded a new SQL database to my hosting server.I am using SQL 2005 and SQL Server Management Studio.How
can I remotely access the SQL database, on my hosting server, to create
or alter tables and queries, using SQL Server Management Studio? Thank You,Miguel

View 2 Replies View Related

Accessing Value From SqlDataSource

Jan 24, 2007

I have a SqlDataSource that returns a list of companies and their details by ProductID.  It also returns the name of the product associated with the ProductID as the final column (which means it appears for every record returned).  I already have a way of determining how many rows were returned, and use that information in a label to say "Your search has returned x records". protected void dsGetSuppliersByProduct_Selected(object sender, SqlDataSourceStatusEventArgs e)    {        int RecordCount = e.AffectedRows;        if (RecordCount == 0)        { lblRecordCount.Text = "<p>No Records found"; }        else        {            if (RecordCount == 1)            { lblRecordCount.Text = "<p>Your search returned 1 record"; }            else            { lblRecordCount.Text = "<p>Your search returned " + RecordCount + " records"; }        }        string ProductName;    }How can I access the ProductName value so that I can extend the label text to say "Your search has returned x records for <ProductName>" ?

View 1 Replies View Related

Accessing 2nd, 3rd And 4th To Last Records

Apr 7, 2008

Hey All
I wish to display the 3rd and 4th to last records of a table on a page. Is there anyway of doing this? I can access the last records by using Count and TOP 1 but i find that count - 1 as the ID to select can be errornous if records are removed from the table. I also tried using ORBER BY followed by LIMIT but kept getting an error in order by clause message.
Any help would be greatly appreciated
Thanks and Regards
 Drew

View 6 Replies View Related

Error Accessing T-SQL UDF From CLR UDF

Jun 11, 2008

Hi all,
I am experiencing the following error when I try to access a T-SQL UDF from within a SQL statement that I execute from a CLR UDF.Msg 6522, Level 16, State 1, Line 2
A .NET Framework error occurred during execution of user-defined routine or aggregate "HelloWorldCLR":
System.Data.SqlClient.SqlException: This statement has attempted to access data whose access is restricted by the assembly.
System.Data.SqlClient.SqlException:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnectionSmi.EventSink.DispatchMessages(Boolean ignoreNonFatalMessages)
at Microsoft.SqlServer.Server.SmiEventSink_Default.DispatchMessages(Boolean ignoreNonFatalMessages)
at Microsoft.SqlServer.Server.SmiEventSink_Default.DispatchMessages(Boolean ignoreNonFatalMessages)
at System.Data.SqlClient.SqlDataReaderSmi.InternalNextResult(Boolean ignoreNonFatalMessages)
at System.Data.SqlClient.SqlDataReaderSmi.NextResult()
at System.Data.SqlClient.SqlCommand.RunExecuteReaderSmi(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at UserDefinedFunctions.HelloWorldCLR()I have tried the SQL BOL and Google with no luck.
Here is the sample code I am using to produce this error:
HelloWorldUDF.sqlIF OBJECT_ID (N'dbo.HelloWorldUDF') IS NOT NULL
DROP FUNCTION dbo.HelloWorldUDF
GO

CREATE FUNCTION dbo.HelloWorldUDF() RETURNS varchar(100)
AS
BEGIN
RETURN 'Hello World'

END
GOHelloWorldCLR.cs using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;

public partial class UserDefinedFunctions
{
[Microsoft.SqlServer.Server.SqlFunction( DataAccess = DataAccessKind.Read )]
public static SqlString HelloWorldCLR()
{
using ( SqlConnection conn = new SqlConnection( "context connection=true" ) )
{
conn.Open();

SqlCommand command = new SqlCommand( "SELECT dbo.HelloWorldUDF()", conn );
return new SqlString( command.ExecuteScalar().ToString() );
}
}
};

Test query:  select dbo.HelloWorldUDF()
select dbo.HelloWorldCLR()  Could some one please confirm that this should be possible or not? Thanks! Joe.

View 3 Replies View Related

Accessing MS SQL DB On Own Server?

Dec 10, 2004

Hi

If my site is hosted with an external company web host can I use ASP.NET pages to connect to a MS SQL DB that is on my company's internal server if I had MS SQL installed on it?

My company's server is always on and always connected to the internet.

I have access to my company's server if I need to set anything up on it for this to happen.

There will not be any kind of overload as the site is not accessed constantly.

Also, would this cause any kind of security leak? If so how would I go about plugging this hole?

Our server does have confidential info on it.

Cheers

kefi2927

View 1 Replies View Related

Accessing DTS From Another Machine

Oct 11, 2000

I am trying to open some DTS packages from another machine, I see the list but when I try to open one and I get the error: The Parameter is incorrect

I have look at permissions and everything looks good. (I can view about 2 out of 20 packages all packages have the same owner.)

Any would be great.

Thanks
Jacqi

View 1 Replies View Related

Accessing SQL From A Web Server Using ASP

Jul 9, 1999

I'm using OLEDB in my ASP code to connect to the SQL database. When I execute the page I got an error saying "438, Microsoft VBScript runtime error, Object doesn't support this property or method"
Anybody knows what this is in reference to.
I tested the same site in another server where IIS and SQL are in the same box and it's working fine.

Thanks for any input in this......

View 1 Replies View Related

Accessing SQL Server With VB6

Jul 19, 2004

I need to write a VB app (VB6) to access and manipulate data within a MS SQL Sever 2000 database. I have experience doing this with MS Access. Is it much different/more difficult to do this with SQL Server?

Thanks

View 5 Replies View Related

Accessing SQL Server Using C++

Nov 25, 2004

What is the easiest way to start executing SQL statements onto a SQL Server 2000 using C++ ?????

Are there any libraries or something I could use ?

View 2 Replies View Related

Accessing From Linux

Nov 24, 2005

Hi All,


Can I connect to the MS SQL database from the Redhat Linux 9.
Is there MS SQL client or database driver on linux available. I wanted to use the data from the MS SQL database in the C++ program running on Linux.

Thanks in advance,

torpedo

View 2 Replies View Related

Accessing The Transaction Log

Jan 6, 2006

Dear All,

Can someone let me know how I can have a look at the transaction log in SQL server. I'd like to find out what INSERT, UPDATE, DELETE commands have been executed on a table today, yesterday etc.

Can I see this easily?

View 8 Replies View Related

Accessing Two Databases At Once

Apr 12, 2006

I'm new to databases as you probably can tell. A friend sent me three data bases, which in my mind should have been one database with all the tables included, but he didn't. So my question is, can you pull info from two databases in the same query?

I write the query acessing one database and the result chart must depend on a where predicate based on accessing tables in another database. If this isn't possible, how do I get the tables I need together, that presently reside in differing databases?

Thanks for the help in advance.

Milfredo

View 8 Replies View Related

Accessing MySQL From .NET

Jan 5, 2004

Hello all,

We are planning to migrate an application written in Perl + mySQL to .NET + MS-SQL Server. The test machine now has SQL Server running. During the development phase in .NET, we would want to access the mySQL database which is being updated at real time, from the Windows box. This is how I think it has to be done:

1. Use DTS to migrate data from mySQL. Does DTS take care of migrating schema and the difference in data types between the mySQL and MS-SQL? Is there any 3rd party software out there that takes care of the migration without any manual labor?

2. Synchronize the data between 2 DBs by creating some kind of a batch job? If so, whats the best way of doing this?

Instead, is it easier to access the live mySQL database on the Linux box from the .NET code and move the DB only after development in the new environment is completed?

Any help/ideas is greatly appreciated.

TIA

View 2 Replies View Related

Accessing Problem

Mar 29, 2004

I want two things:

-Let the windows account be the login on the SQL server. This is not a problem.


1.But I also want to use the windows login as authentication method for the webpage. The users have to explicitly log-in.
2.Is it a problem to retrieve all users within a windows domain?

I’m using .net 2003.

View 2 Replies View Related

Accessing Second Record Set

May 7, 2004

hello all,

i had two stored procedures,where the 1st SP is calling 2nd SP(which returns 2 record sets).
how can i access the second recordset from the 1st SP

it would a great help if anyone help me out!!

thanx in advance,
ravi.

View 2 Replies View Related

Accessing SQL Through Another Computer

Apr 29, 2008

Hello, me and my friend has set up an SQL, I am wondering if it is possible to access the SQL server from my computer when hosted on his.

thanks

View 1 Replies View Related

Accessing Another DB Through A View

Mar 12, 2008

I have to troubleshoot a problem with a complex sproc that is running against a number of views that select entire tables from another "production" database. The problem we are having is that while the views should be read-only, there are no transactions, and no locking, the application's process on SQL Server is blocking anyone else who tries to write data. I'm wondering if this method of using a view as a proxy to another DB is effecting the block. The reason for doing this was to improve performance by offloading the production DB, but since it's the same instance of SQL Server, does it really matter? THX for your advice.

Jerry O'Brien

View 1 Replies View Related

Accessing Row In ForEach

Dec 16, 2007

Hello everybody.
I'm having a problem:
As the result of Dataflow task I get a recordset with about 50 columns in it. Now I need to loop through each row in the dataset and make some manipulations with the data in all 50 columns in a single script task. So I need 'em as separate variables.
Ofcourse I can make a For Each Loop container with ADO enumerator, and map each column to specific variable. But that's not a very good thing, because if the format changes, i will have to remap everything again (takes a lot of time to remap 50 values)

So is it possible:
1. To map using not index of columns, but there names?
2. To pass actual row into the script task?

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved