T-SQL Code To Check The Status Of Sql Job On SQL Server 2000
Jan 7, 2008How to query the database to see if a job is still running?
View 1 RepliesHow to query the database to see if a job is still running?
View 1 Repliesi have 70 SQL database servers and i setup DB Mail on the 70 Servers, i want to know is there a way to find the status of all the jobs which i assigned the DB Mail and if its working/failing... is there a script i can run on powershell or SQL to find out that information
View 1 Replies View RelatedI have a database In Recovery.
Where do I check the completion status of the recovery?
Hi all--I'm trying to convert a function which I inherited from a SQL Server 2000 DTS package to something usable in an SSIS package in SQL Server 2005. Given the original code here:
Function Main()
on error resume next
dim cn, i, rs, sSQL
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"
set rs = CreateObject("ADODB.Recordset")
set rs = DTSGlobalVariables("SQLstring").value
for i = 1 to rs.RecordCount
sSQL = rs.Fields(0).value
cn.Execute sSQL, , 128 'adExecuteNoRecords option for faster execution
rs.MoveNext
Next
Main = DTSTaskExecResult_Success
End Function
This code was originally programmed in the SQL Server ActiveX Task type in a DTS package designed to take an open-ended number of SQL statements generated by another task as input, then execute each SQL statement sequentially. Upon this code's success, move on to the next step. (Of course, there was no additional documentation with this code. :-)
Based on other postings, I attempted to push this code into a Visual Studio BI 2005 Script Task with the following change:
public Sub Main()
...
Dts.TaskResult = Dts.Results.Success
End Class
I get the following error when I attempt to compile this:
Error 30209: Option Strict On requires all variable declarations to have an 'As' clause.
I am new to Visual Basic, so I'm on a learning curve here. From what I know of this script:
- The variables here violate the new Option Strict On requirement in VS 2005 to declare what type of object your variable is supposed to use.
- I need to explicitly declare each object, unless I turn off the Option Strict On (which didn't seem recommended, based on what I read).
Given this statement:
dim cn, i, rs, sSQL
I'm looking at "i" as type Integer; rs and sSQL are open-ended arrays, but can't quite figure out how to read the code here:
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"
set rs = CreateObject("ADODB.Recordset")
This code seems to create an instance of a COM component, then pass provider information and create the recordset being passed in by the previous task, but am not sure whether this syntax is correct for VS 2005 or what data type declaration to make here. Any ideas/help on how to rewrite this code would be greatly appreciated!
Hi,I want to create a tool that run over Windows Server 2003 and checksthe sql server 2000 edition (Enterprise, Standard, Personal,Developer).I know I can do from the query analyzer - "Select @@version".But how can I do it from code, is there a WMI API that can tell mewhat's the edition?Thanks,Koby
View 4 Replies View RelatedHi all
in my project, I need to access SQL job to finish something. But sometimes, the status of SQL Agent is not running, which needs me to check the status first. I am wonder are there some functions or some ways to check the status. If you know, please response me.
I appreciate your response !
Is it possible to create an SSIS package that checks for a running Query on my SQL db?
I need to some how check my SQL server and see if there is a query running, if its running I need to set an indicator in my table for my app. This job needs to be scheduled and run nightly (which I can do). But how can I query SQL and see if the query is still running?
We have a really annoying job here that relies on a particular file to be created before several imports run. An old file may already exist, but if it isn't recent, we don't want the import to run. This job can't delete it, since other jobs use that file. What we'd like to do is to be able to check the creation date of the file, and if it is after a certain time of day, run the import, else, delete the file. I know of xp_fileexists. Is there anything similar in SQL that can return file information or am I stuck parsing the output from xp_cmdshell 'dir F:ftpcoreinputready.txt'? Any help or hints are appreciated. Let me know if you need more info. Thanks. -D.
View 14 Replies View RelatedHow to check status(valid/invalid) for all stored procedure in my DB...
View 14 Replies View RelatedSo far, I only deal with Import & Export data from one server to another.
Earlier today, I initiated a table import, from SQL Server AAA to SQL Server BBB.
I can access Windows Server BBB (and SQL Server BBB) from Computer CCC through Remote Desktop.
My question: Is there any way to check if the import was successful or not, from another computer? Is there a log that I can see? I open the Management>>SQL Server Log, but the import/export is not recorded.
I can see the new table that I imported on Server BBB, but not sure if the import was successful or stopped in the middle since I initiated the import from Computer/Server AAA (I don't have access to Server AAA at this moment). I guess, I need to see the time when it's all done/completely imported. I checked the table properties, but it listed the time of creation. I don't see the time of transfer completed.
Please help,
Thanks.
Using SQL Server 2005 / Windows Server 2003.
Hi,
I have a full text index created on a table with PK, text column and timestamp column. The table has 10 million rows. I tried one time full population and CPU spiked so after couple of hours i stopped full population.
Now since i have a timestamp column in the table I want to do a incremental population.
But when I run a select
SELECT * FROM sys.fulltext_indexes
The incremental_timestamp column is showing value 0x0000000000000000
How do I find how long will it take for incremental population to complete?
Thanks,
Yogesh
Hi All,
I have a field 'Rowguid' of type uniqueidentifier in a table. This field is the last field in the table. In this case if I update a record through the application I don't get any error. Suppose if there are additional fields after the field Rowguid I get the error "Multiple-Step operation cannot be generated Check each status value"
For your reference I have used the following statement to add the RowGuid field
Alter table <tablename>
Add RowGuid uniqueidentifier ROWGUIDCOL NOT NULL Default (newid())
Can anyone please help me.
Thanks
Sathesh
Hi,
How do I programmatically check a row group's Visibility or Expand/Collapse flag in a matrix table? For example, I have a matrix table contains the following groups:
Row groups: Facility --> Category Type --> Category
Column groups --> year, quarter, month
I want to be able to programmatically update the table content if Category rows are not visible (Category Type row group is collapsed).
Thanks.
SouBee
I am using execute sql task and my sql statement contains
EXEC test ?
procedure test has 2 parameters. I added parameters using parametermapping tab. When I run i get an error message
Multiple-step OLE DB operation generated errors. Check each OLE DB status value
Hi all,
We have Windows 2003 64 sp2 Xeon, 2005 EE SP2 64 bit...
Trying to do conversion from DTS sql 2000..One package use load from excel to sql..So I tried to create same thing by myself.. Hell, so many issues.. So I used wizard, package created, I changed Run64bit to False, tried to run package, once - completed in debug mode.. Now it's time to create deployment utility and deploy package..During execution of manifest file got error:
Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".
In BIDS, open up solution and tried to rerun package again - no way,".. cannot acquire connection from connection manager blah blah blah.."
Even tried to fire package without debugging, it fires 32 bid execution utility, so no question about 64 bit mode.. package failed..
Execution GUID: {CE11CF95-A25E-4285-A8B0-9E28E51A6785}
Message: ExternalRequest_post: 'IDataInitialize::GetDataSource failed'. The
external request has completed.
Start Time: 2007-11-09 09:41:25
End Time: 2007-11-09 09:41:25
End Log
Error: 2007-11-09 09:41:25.95
Code: 0xC0202009
Source: Package_name loader Connection manager "SourceConnectionExcel"
Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred.
Error code: 0x80040E21.
An OLE DB record is available. Source: "Microsoft OLE DB Service Components" H
result: 0x80040E21 Description: "Multiple-step OLE DB operation generated error
s. Check each OLE DB status value, if available. No work was done.".
End Error
Log:
Name: OnError
Source Name: Data Flow Task
Source GUID: {2A373E56-8AAF-40E9-B9EF-4B2BB40175F0}
Execution GUID: {CE11CF95-A25E-4285-A8B0-9E28E51A6785}
Message: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER
. The AcquireConnection method call to the connection manager "SourceConnection
Excel" failed with error code 0xC0202009. There may be error messages posted be
fore this with more information on why the AcquireConnection method call failed.
Any help..?
My goal is to create a trigger to automatically set the value for a status id on a table based on set criteria. Depending on the values of other fields will determine the value that the status id field is assigned. So far, I have written the trigger to update the status id field and I go through a seperate Update statement for each status id value. The problem is that I can't get this to work at the record level. The problem that I am getting is that if I have 50 records in TABLE1 and at least one of them satisfies the where clause of the update statement, all of the records get updated. So, using these two update statements, all of my records end up with a status value of '24' because that was the last update statement run in the trigger. Here is the code I have so far:
CREATE TRIGGER dbo.JulieTrigger1
ON dbo.Table1
AFTER INSERT,UPDATE
AS
BEGIN
BEGIN TRY
/*Update Table1.Status to POTENTIAL (id 23) status */
UPDATE TABLE1
SET status_id = 23
WHERE EXISTS (SELECT *
FROM TABLE1 a INNER JOIN TABLE2 b
ON b.order_id = a.order_id
WHERE a.start_dt IS NULL
AND b.current_status_ind = 1
AND b.lead_status_id NOT IN (15,16)
AND a.order_id = TABLE1.order_id)
/*Update Table1.Status to ACTIVE (id 24) status */
UPDATE TABLE1
SET status_id = 24
WHERE EXISTS (SELECT *
FROM TABLE1 a
WHERE fill_ind = 1
AND (end_dt IS NULL OR end_dt > getdate() )
AND a.job_order_id = TABLE1.job_order_id)
END TRY
BEGIN CATCH
DECLARE @ErrorMessage NVARCHAR(4000);
DECLARE @ErrorSeverity INT;
DECLARE @ErrorState INT;
SELECT
@ErrorMessage = ERROR_MESSAGE(),
@ErrorSeverity = ERROR_SEVERITY(),
@ErrorState = ERROR_STATE()
IF @@TRANCOUNT > 0
ROLLBACK TRAN
-- Return the error to the calling object
RAISERROR (@ErrorMessage, -- Message text.
@ErrorSeverity, -- Severity.
@ErrorState -- State.
)
END CATCH
SET NOCOUNT ON;
END
GO
Thanks in advance for any help!
-Julie
Hi,
I am using ATL COM library application. It is using sql data base for fetching the records. Some times, i get the following error. could you please let me know, why this happens? This is not reproduceble every time.
(Error! hr=80040e21, hrDesc=Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work
Here is the code to connect to database which i am using.
CDataSource db;
CDBPropSet dbinit(DBPROPSET_DBINIT);
dbinit.AddProperty(DBPROP_AUTH_INTEGRATED, OLESTR("SSPI"));
dbinit.AddProperty(DBPROP_INIT_CATALOG, (const char *)bDatabase);
dbinit.AddProperty(DBPROP_INIT_DATASOURCE, (const char *)bServer);
dbinit.AddProperty(DBPROP_INIT_LCID, (long)1033);
dbinit.AddProperty(DBPROP_INIT_PROMPT, (short)4);
dbinit.AddProperty(DBPROP_INIT_TIMEOUT, (short)150);
hr = db.Open(_T("SQLOLEDB.1"), &dbinit);
if (FatalError(hr, "db.Open", buf))
{
*iErrorCode = hr;
return S_OK;
}
Any help, appreciated.
Thanks,
Satish
Hi Everybody,
Can anybody tell me how to get the number of commands delivered per minute in case of Merge Replication with Publisher and subscribers.
This way, we can be sure that even if there is a latency (due to high volume transaction processing), replication is in good shape and things will catch up soon.
Also if there are any other similar measures which can be monitored to make sure that replication is going on fine, it would be great
Please let me know If anyone has got information on same.
I've seen other posts on this topic, but not with error 0x32.
I was attempting to change a CLUSTERED instance of SQL 2005 from dynamic port to static port and in the process have somehow messed it up to the point it will no longer start. Version is 9.00.2047.00
The ERRORLOG has the following
2007-01-31 15:02:05.77 spid9s Starting up database 'model'.
2007-01-31 15:02:05.77 Server Error: 17182, Severity: 16, State: 1.
2007-01-31 15:02:05.77 Server TDSSNIClient initialization failed with error 0x32, status code 0x1c.
2007-01-31 15:02:05.77 Server Error: 17182, Severity: 16, State: 1.
2007-01-31 15:02:05.77 Server TDSSNIClient initialization failed with error 0x32, status code 0x1.
2007-01-31 15:02:05.77 Server Error: 17826, Severity: 18, State: 3.
2007-01-31 15:02:05.77 Server Could not start the network library because of an internal error in the network library. To determine the cause, review the errors immediately preceding this one in the error log.
2007-01-31 15:02:05.77 Server Error: 17120, Severity: 16, State: 1.
2007-01-31 15:02:05.77 Server SQL Server could not spawn FRunCM thread. Check the SQL Server error log and the Windows event logs for information about possible related problems.
The values have only been changed using SQL Server Configuration Manager (no direct registry changes have been made).
Thanks for you help.
Hello,I Have a code:<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" InsertCommand="INSERT INTO [shop_clients] ([ID], [IMIE]) VALUES (@ID, @IMIE)"> <InsertParameters> <asp:Parameter Name="ID" Type="Int32" /> <asp:Parameter Name="IMIE" Type="String" /> </InsertParameters> </asp:SqlDataSource> SO this code It will allow me insert to database SQL textbox - name ?If yes How I can:If I click the button My textbox - name, insert to databasePlease me help :)
View 1 Replies View RelatedCan anyone tell me what is wrong with this line of code..
I am missing someting on both line of code
exec ("print 'DBCC INPUTBUFFER FOR SPID " + @spid + "'")
exec ("dbcc inputbuffer (" + @spid + ")")
I want to check whether or not a DB is online when a report is run. If it is offline I would like to display a friendly message.
Currently my users get error messages when they run a report against a database that is offline. They get incomplete reports if they run a report while the database is being restored.
How can I detect the state of the database and display the appropriate friendly message? Is there a property to check or an event where I should write some code?
I look forward to your response.
I know my question is kinda weird but it seems I have to do this way or threre are some better ideas.
Could you show me a sample C code to connect to a data server and call a stored procedure to import an image file into SQL Server 2000?
I am writing an extended stored procedure in VS 2003 .NET and it seems extended stored procedure can only work with C code.
Thanks!
YL
hi Experts,
any one tell me that how to write code to take back up of sql server database?
Hi..
I have a web application(ASP.NET 2.0 + C#). I have sql server 2000 as well as sql server 2005.
Several queries in my application work well with the sql server 2005, and the same query fails in the sql server 2000.
How to check if the database is connected to sql server 2000 or sql server 2005 and then call the queries accordingly through the c# code?
Thanks
My web project (ASP.NET 2.0 / C#) runs against sql server 2000 and uses the System.Data.SqlClient.using System.Data.SqlClient;
I use System.Data.SqlClient.SqlConnection and System.Data.SqlClient.SqlCommand to make the connections to the database and do selects and updates. Is it correct to continue to use these against SQL Server 2005? I ask because I made a connection string (outside of .Net) for SqlServer 2005 using the SQL native provider and it had the following - Provider=SQLNCLI.1 and any connection strings I had made (also outside of ASP.NET) fro SQL Server all used Provider=SQLOLEDB.1. This is why I wondered if there is a different SqlClient in .Net 2.0 for SQL Server 2005?
Cheers
Al
Hi all,
Please help me for the code of connectivity
it was working fine,but,when i hav written code for validation for id n password,its showing error as
Violation of PRIMARY KEY constraint 'PK_Login'. Cannot insert duplicate key in object 'login_detail'. The statement has been terminated.
Here is my code given below.
Please help me
Imports System
Imports System.IO
Imports System.Xml
Imports System.Text
Imports System.Security.Cryptography
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data
Imports System.Data.SqlClientPublic Class WebForm1
Inherits System.Web.UI.Page#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End SubProtected WithEvents txtUser As System.Web.UI.WebControls.TextBox
Protected WithEvents txtPwd As System.Web.UI.WebControls.TextBoxProtected WithEvents btnSubmit As System.Web.UI.WebControls.Button
Protected WithEvents lblError As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End RegionPrivate Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim objConn As SqlClient.SqlConnection
Dim ds As New DataSetDim m_strConnection As String = "server=172.16.152.17;Database=Trial;UID=abhi_Asset4;PWD=L!nux001;Connect Timeout=100"objConn = New SqlClient.SqlConnection
objConn.ConnectionString = m_strConnection
objConn.Open()
Dim strSQL As String
strSQL = "insert into login_detail(UserID,Password) values('" + txtUser.Text + "','" + txtPwd.Text + "')"Dim objCommand As SqlClient.SqlCommandobjCommand = New SqlClient.SqlCommand(strSQL, objConn)
objCommand.CommandText = strSQL
objCommand.ExecuteNonQuery()
objConn.Close()
End SubPrivate Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If (txtUser.Text.Trim() = "") Then
lblError.Text = "UserID should not be blank"
ElseIf (Convert.ToInt32(txtUser.Text.Length) < 5) Then
lblError.Text = "UserID length must be more than 5"
ElseIf (Convert.ToInt32(txtUser.Text.Length) > 20) Then
lblError.Text = "UserID length must not be greater than 20"
ElseIf (txtPwd.Text.Trim() = "") Then
lblError.Text = "Password should not be blank"
ElseIf (Convert.ToInt32(txtPwd.Text.Length) < 5) Then
lblError.Text = "Password length must be more than 5"
ElseIf (Convert.ToInt32(txtPwd.Text.Length) > 20) Then
lblError.Text = "Password length must not be greater than 20"
Else
Server.Transfer("Success.aspx")
End IfEnd Sub
End Class
I want to check if a table is empty using query code?
How to do this?
hi - I am developing locally using .Net 2.0/Access but just recently started trying out SQL Server Express. I have deployed my application to a host who provides 2.0 but as would be expected only MSDE/SQL server 2000. Now if I'd switch completely to SSE, would my SQL queries (which are pretty simple) work on MSDE or SQL server 2000? The only thing I see as more sophisticated sql queries would be the built-in 2.0 Roles/Membership functions... Do you think they would run smoothly on MSDE/SQL 2000?Finally... since the database is already done locally, is there any way (a stored procedure for example) to copy it's scheme if I'd create a new DB on my host's SQL server?
View 2 Replies View Relatedhi
How to upload excel data to sql server 2000 thorugh .net application.
I want like one upload button should be there,we have to browese corresponding excel file and then we need to upload to database.
before uploading it has to ask appending or replace everything in table.
both options appending and replacing shoulb be there.
How to upload ?
any sample code is there plz give me.
Please help me.
Thanks.
Karikalan writes "We need alpha numeric auto increment code in sql server 2000.
(for eg.: ico1001, ico1002, ico1003,......)
Can any one send the code in MS sql server 2000? plz ..................
bcoz i am beginner in sqlserver 2000"
Hello,
I'd like to be able to poll a SQL 2000 subscriber database to obtain the current replication status. For example, I'd like to know when the subscriber is sitting idle (e.g. "waiting for changes..."), when it is actively replicating (e.g. "applying script..."), or when it is in an error state (e.g. "The Merge Agent failed...").
I realize I can query the table MSmerge_history which contain a comments and error_id field that may be useful. However, there is no status field that I could easily code against.
Does anyone have any ideas?
I would like to have an option of selecting the rows in my reports designed using reporting services 2000.
I would like to have a check box inside the table. when the user viewing the report he can select the rows using this checkbox and print only the selected table rows.
can anyone help how to implement this logic in ms reporting services 2000?