High Insert Actiivty At Unexpected Times?

Apr 5, 2000

Hello:

I am supporting a financial application on mssql 6.5,sp4.

Other than at month-end when activiy is high, we have at some unexpected heavy insert activlty as well as deletes at unexpected times. Other than periodically watching 'current activity' or running sp_who2, we aren't sure when this happens and by whom if we don't see it.

Does any one know how I can monitor this unexpected activity?

IS there I can run periodically to trap which spid and/or user who is running such activity?

THanks.

DAvid Spaisman

View 1 Replies


ADVERTISEMENT

Bulk Insert: Unexpected End-of-file (EOF) Encountered...

Apr 17, 2007

Hi to all,I have a problem about a importation of a file *.csv with SQL Server,through a bulk insert, called in a store procedure that a c# sw calls.This is the description of the error:-----System.Data.SqlClient.SqlException è stata individuataMessage="Bulk Insert: Unexpected end-of-file (EOF) encountered indata file.
OLE DB provider 'STREAM' reported an error. The providerdid not give any information about the error.
OLE DB error trace[OLE/DB Provider 'STREAM' IRowset::GetNextRows returned 0x80004005:The provider did not give any information about the error.].
Thestatement has been terminated."Source=".Net SqlClient Data Provider"ErrorCode=-2146232060Class=16LineNumber=1Number=4832Procedure=""Server="ets3971"State=1StackTrace:at System.Data.SqlClient.SqlConnection.OnError(SqlExc eptionexception, Boolean breakConnection)atSystem.Data.SqlClient.SqlInternalConnection.OnErro r(SqlExceptionexception, Boolean breakConnection)atSystem.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObjectstateObj)at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand cmdHandler, SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObjectstateObj)atSystem.Data.SqlClient.SqlCommand.FinishExecuteRead er(SqlDataReader ds,RunBehavior runBehavior, String resetOptionsString)atSystem.Data.SqlClient.SqlCommand.RunExecuteReaderT ds(CommandBehaviorcmdBehavior, RunBehavior runBehavior, Boolean returnStream, Booleanasync)atSystem.Data.SqlClient.SqlCommand.RunExecuteReader( CommandBehaviorcmdBehavior, RunBehavior runBehavior, Boolean returnStream, Stringmethod, DbAsyncResult result)atSystem.Data.SqlClient.SqlCommand.InternalExecuteNo nQuery(DbAsyncResultresult, String methodName, Boolean sendToPipe)at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at sarbox.Default.LoadFlux_Click(Object sender, EventArgs e) inc:Inetpubwwwrootarbox2.2SoxAdminDefault.aspx .cs:line 1509---Th@nks to allAB@

View 3 Replies View Related

Don't Want To Insert Same Values 2 Times.

Sep 6, 2006

create proc dbo.usp_CatchAddressException @tableName varchar(500) as
-- alter proc dbo.usp_CatchAddressException @tableName varchar(500) as


begin
set nocount on
declare @sql varchar(700)

-- truncate table tempException
set @sql = 'insert hava_dcde.dbo.STREET_EXCEPTION (id_town, id_voter, pre_value, nbr_exception, date_stamp)
select a.id_town, a.id_voter, substring(a.ad_str1, 1, len(a.ad_str1) - charindex('' '', reverse(a.ad_str1))), ''20'', getdate()
from HAVA_DCDE.dbo.' + quoteName(@tableName)+ ' a
where substring(a.ad_str1, 1, len(a.ad_str1) - charindex('' '', reverse(a.ad_str1))+1) not in
(select nm_street from HAVA_DCDE.dbo.state_streets ss)'
-- and a.id_town = + @tableName
-- print(@sql)

exec(@sql)
set nocount off
end
---------------------------------------------------


when i run this SP 2 times, it will insert the values 2 times.
what should i do if i don't want to insert the same values 2 times?
I'm confussed, Should i use update? any input will be appreciated.

View 20 Replies View Related

My INSERT Statements Works... 8/10 Times

Jun 8, 2004

I'm using the following code to add some data to a table:
Dim rand As Random = New Random
Dim num As Int32 = rand.Next(10000000)
Dim strConn as string = "......."
Dim sql as string = "INSERT INTO tblitemid (itemid, userid, datetime, supplier, comment, commenttype, uniqueid) VALUES ('" & label1.Text & "', '" & user.identity.name & "', '"& System.DateTime.Now & "','3763' ,'" & textbox1.text & "' , 'C' ,'" & num & "')"
Dim conn as New SQLConnection(strConn)
Dim Cmd as New SQLCommand(sql, conn)
Try
conn.Open()
Catch SQLExp as SQLException
Response.Write ("An SQL Server Error Occurred: " & e.toString())
Finally
cmd.ExecuteNonQuery
conn.Close()
End Try


As far as I can tell the code works fine. But for some odd reason I click the button, the code execute and the page closes as it should, but the data is never inserted into the database. I cant really seem to pick up on any paterns for why this would be happening. As a rough guess I'd say it doesnt insert the data 1 out of every 5 times or so it seems. Anyone every have any experience with this? Any comments would be helpful, cuz I'm at a loss.
If youd like to see more code let me know....
Thanks,
Scott

View 3 Replies View Related

Insert Fails----- Database Times Out

Mar 26, 2001

Hi all,

I have a table with 4869068 rows and when some one tries to insert the records into this table the database times out....Does any one know what could be the reason and from where do I start debugging.
I have no problem with the disk space?

Thanks,
Venu

View 1 Replies View Related

INSERT Same Record 1000 Times

Jan 14, 2008



Ok, so I have a primary table that contains the count of a linked table. Since I can let the identity update itself, I should be able to insert the same values into the linked child table.

I need to put the same record in the child table 1000 (that's an arbitrary number, this will be programatically determined by the user) times.

I understand that I can do this:


INSERT INTO SomeTable (Cols) VALUES (vals)
GO 1000

However, I can't make this work when doing an ADO.NET ExecuteCmd. It doesn't like the Go 1000 part of it.

Does anyone have an idea how I can do this VERY QUICKLY without having to execute a separate insert for every item (or batch them)?

The number could be as high as 250,000 in the child table.

Thanks!

View 16 Replies View Related

How To Run Insert Query For Required No.of Times With Different Parameters...?

Apr 22, 2008

Hi All,

I have two tables in my database.
I want to insert date and no.of hours worked on that day for a particular project.
So in a week if end user enters 7 dates and hrs for each day......
i have to insert those values into the table against one project only.
Can any one please help me out how to run insert query for 7 times (in a week) with different parameters

Thanks,
Praveen

View 5 Replies View Related

High Availability To High Protection Without Reconfiguring Mirroring

Apr 23, 2007

Hi,

Is there a way to configure mirroring to go from High Availability to High Protection without having to reconfigure Database Mirroring? Using the interface in Management Studio, I can change the configuration option to High Performance, but not High Protection despite both of them being Synchronous.

If not, what are the recommended steps to configure the mirror once it already has been configured? Is just like initially setting up the mirror or would there be any shortcuts I could take? If I stop the mirroring and remove the witness, will the High Protection option be available?

Thanks,
J.

View 3 Replies View Related

High Safety Changed To High Performance After Fail Over ?

Mar 6, 2008

Hi There

I realise this is a stupid quesiton but i cannot really find any confirmation of this in BOL.


If you are running High Safety with automatic failover, when failover occurs does this automatically change to High Performance mode. SInce for failover to occur something has happen with the primary , it will be impossible to commit transactions on the new primary and mirror asyncronously since 1 of them is no longer available.


So am i correct in assuming that automatic failover also automatically changes the mode to High Performacne for that session?

Thanx

View 4 Replies View Related

Unexpected EOF From SQL

Jun 8, 1999

I am working with SQL server 6.5.
DB Library display error unexpected EOF from SQL when I execute a batch Can somebody tell me what can occurs this error ?

View 1 Replies View Related

Unexpected SKU Value

Nov 19, 2007

We are trying to configure and run SSRS on a server installed at the customer data centre. The ReportServer web service is unable to start up and leaves behind this odd error.

w3wp!library!1!11/19/2007-19:21:29:: i INFO: Initializing RunningRequestsDbCycle to '60' second(s) as specified in Configuration file.
w3wp!library!1!11/19/2007-19:21:29:: i INFO: Initializing RunningRequestsAge to '30' second(s) as specified in Configuration file.
w3wp!library!1!11/19/2007-19:21:29:: i INFO: Initializing CleanupCycleMinutes to '10' minute(s) as specified in Configuration file.
w3wp!library!1!11/19/2007-19:21:29:: i INFO: Initializing DailyCleanupMinuteOfDay to default value of '120' minutes since midnight because it was not specified in Configuration file.
w3wp!library!1!11/19/2007-19:21:29:: i INFO: Initializing WatsonFlags to '1064' as specified in Configuration file.
w3wp!library!1!11/19/2007-19:21:29:: i INFO: Initializing WatsonDumpOnExceptions to 'Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException,Microsoft.ReportingServices.Modeling.InternalModelingException' as specified in Configuration file.
w3wp!library!1!11/19/2007-19:21:29:: i INFO: Initializing WatsonDumpExcludeIfContainsExceptions to 'System.Data.SqlClient.SqlException,System.Threading.ThreadAbortException' as specified in Configuration file.
w3wp!library!1!11/19/2007-19:21:29:: i INFO: Initializing SecureConnectionLevel to '0' as specified in Configuration file.
w3wp!library!1!11/19/2007-19:21:29:: i INFO: Initializing DisplayErrorLink to 'True' as specified in Configuration file.
w3wp!library!1!11/19/2007-19:21:29:: i INFO: Initializing WebServiceUseFileShareStorage to 'False' as specified in Configuration file.
w3wp!library!1!11/19/2007-19:21:29:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException: The report server has encountered a configuration error. See the report server log files for more information., unexpected SKU value;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException: The report server has encountered a configuration error. See the report server log files for more information.
We suspect that when they first installed SQL Server, the optical media that they reported to be "faulty" was replaced with another one, and ended up installing Enterprise Edition of SQL Server. They were supposed to install Standard Edition. However, we'd like to confirm if the error message really the case that somehow SSRS is expecting the Std Ed SKU but meets up with Ent Ed?

View 2 Replies View Related

Unexpected LIKE Behavior

Apr 22, 2007

SQL Server 2000 SP4.Running the script below prints 'Unexpected':-----------------------------DECLARE @String AS varchar(1)SELECT @String = 'z'IF @String LIKE '[' + CHAR(32) + '-' + CHAR(255) + ']'PRINT 'Expected'ELSEPRINT 'Unexpected'-----------------------------If the @String variable is set to 'y' (or in fact any ANSI character otherthan 'z'), the result is 'Expected'. The comparison also evaluates asexpected if CHAR(255) is replaced with CHAR(254). The server collation, ifthat matters, is SQL_Latin1_General_CP1_CI_AS.It would be helpful to find the explanatin of this behavior. Thanks.--(remove a 9 to reply by email)

View 2 Replies View Related

Unexpected Xmlns=''

Feb 5, 2008

I'm having issues serializing an XMLChoiceIdentifier in SQLServer. I'm attempting to serialize a type within a larger XML message. The parent object contains and array of sub-objects. The xml I'm trying to serialize is:


<DocumentRequest action="GET">

<Documents>

<DocumentIDList>


<DocumentIdentifier id="1" />

<DocumentIdentifier id="2" />
</DocumentsIDList>
</Documents>
</DocumentRequest>

The relavent parent object code is:

[XmlTypeAttribute(IncludeInSchema = false)]

public enum RequestElementType

{


Documents,

Files,

Folders

}


[Serializable]

[SqlUserDefinedType(Format.UserDefined, IsByteOrdered = true, MaxByteSize = 8000)]

public struct DocumentRequest : IBinarySerialize, ICloneable, IComparable, INullable

{


private bool _isNull;

private string _action;



[XmlAttribute("action")]

public string Action

{


get { return _action; }

set { _action == value; }


_isNull = false;

}




[XmlChoiceIdentifier("RequestElementChoice")]

[XmlElement("Documents", typeof(Documents))]

[XmlElement("Files", typeof(Files))]

[XmlElement("Folders", typeof(Folders))]

public object RequestElement;




[XmlIgnore]

public RequestElementType RequestElementChoice;


....
}

The first child object is ...


[Serializable]

[SqlUserDefinedType(Format.UserDefined, IsByteOrdered = true, MaxByteSize = 8000)]

public struct Documents : IBinarySerialize, ICloneable, IComparable, INullable

{


private bool _isNull;

private DocumentIdentifier[] _docIDs;



[XmlArrayItem("DocumentIdentifier", typeof(DocumentIdentifier))]

[XmlArray("DocumentIDList")]

public DocumentIdentifier[] DocumentIDs

{


get { return _docIDs; }

set

{


_docIDs = value;

_isNull = false;

}
}




[XmlIgnore]
public int DocumentIDCount
{


get { return _docIDs.Length; }

}

....
}

and the grandchild object is:


[Serializable]

[SqlUserDefinedType(Format.UserDefined, IsByteOrdered = true, MaxByteSize = 8000)]

public struct DocumentIdentifier : IBinarySerialize, ICloneable, IComparable, INullable

{


private bool _isNull;

private int _idNumber;



[XmlAttribute("id")]

public int ID

{


get { return _idNumber; }

set

{


_idNumber = value;

_isNull = false;
}

}




....
}

The error I keep receiving in SQLServer is:


A .NET Framework error occurred during execution of user-defined routine or aggregate "DocumentRequest":

System.InvalidOperationException: There is an error in XML document (2, 2). ---> System.InvalidOperationException: <Documents xmlns=''> was not expected.

System.InvalidOperationException:

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read156_DocumentRequest()

System.InvalidOperationException:

at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)

at System.Xml.Serialization.XmlSerializer.Deserialize(TextReader textReader)

at Mitochon.Global.Messaging.Internal.DocumentRequest.Parse(SqlString s)

at Mitochon.Global.Messaging.Internal.DocumentRequest.Read(BinaryReader r)

at DocumentRequest::.Deserialize(IntPtr , DocumentRequest& )

Any have any advice on how to get rid of this error?

View 1 Replies View Related

Unexpected Error

May 31, 2007

Dear All,

I'm installing SQL Server 2005 on Windows Server 2003 R2. When installing the support files for the SQL installation I receive the following error message:

"There was an unexpected failure during the setup wizard. You may review the setup logs and/or click the help button for more information"

The information I receive when clicking on the help button are as follows:
LinkID: 20476
ProductName: Microsoft SQL Server
Product Version: 9.00.1399.06
Message Source: setup.rll
Message ID: 50000
EvtType: setupsqlsetupactions.cpp@invokeS

I tried looking on the net for probable causes, but could not find any.

Anybody with answers/suggestions?

Many Thanks,

Franz

View 16 Replies View Related

Unexpected End-of-file (EOF) SQL DTS

Dec 13, 2006

when i am running bulk insert from codebehind but have a error =


"Unexpected end-of-file (EOF) encountered in data file.
OLE DB provider 'STREAM' reported an error. The provider did not give any information about the error.
OLE DB error trace [OLE/DB Provider 'STREAM' IRowset::GetNextRows returned 0x80004005: The provider did not give any information about the error.].
The statement has been terminated."



can i do ?

View 1 Replies View Related

Unexpected Server Restart

Sep 27, 2000

Has anyone ever experienced the SQL Server unexpectedly rebooting?

Yesterday my SQL Server 7 installation rebooted itself and the error log seemed fine as did the restart. The only evidence I can find was a message in the event viewer's application log stating the the MSSQLServer service terminated unexpectedly. Any ideas are appreciated.


Thanks,

- D

View 2 Replies View Related

BCP Giving Error &#34;unexpected Eof&#34;

Mar 19, 1999

Hi ,

I am trying to import a .csv file to SQL server 6.5, I get the db library error "Unexpected EOF encountered in BCP data-file"

What can be the problem with the file ?
Its very important to load this data.

Any help is appreciated.

Thanks
Ajay

View 4 Replies View Related

Unexpected Error When Open DTS

Nov 8, 2005

I created a few DTS packages in our Test Server saving them as file.dts. When I try to open them in from the production server I get an Unexpected error and the DTS is not opened. Do you have any fresh idea for me, please? Thanks!! :)

View 1 Replies View Related

ROUND Unexpected Result

Feb 8, 2006

/*********** Script 1 **************/
declare @nr_1 as decimal (10,2)
declare @nr_2 as decimal (10,2)
set @nr_1=5
set @nr_2=3
select round(@nr_1/@nr_2,0)

RESULT = 2

/*********** Script 2 **************/

select round(5/3,0)

RESULT = 1

What it is the explication for these difference ?

View 1 Replies View Related

DTS Package With Unexpected Issues

Jul 23, 2005

I've got a DTS package that runs an active-x script. The script issimple - it runs a stored procedure and saves the results to a CSVfile. I kept getting this error message when trying to run it sayingthat the recordset object I was using could not be used when closed.Well, it didn't make a whole lot of sense to me as to why that washappening, and it doesn't realte to my question except to give you asense of what I'm trying to do. After spending an inordinate amount oftime on that... I decided to just create a SQL Server connectionobject and an Excel Object and then use a transformation to load thequery results. Simple enough, or so I thought. So in thetransformation object under the Source tab, I typed in the query to runthe Stored Procedure:Declare @S nvarchar(30)Declare @E nvarchar(30)SET @S = Convert(nvarchar(30), GetDate()-1, 101) + ' 12 AM'SET @E = Convert(nvarchar(30), GetDate()-1, 101) + ' 11:59:59 PM'exec CTI_REPORT_Q_ACTIVITY_DETAIL @S, @EAnd then I clicked on the preview button. I got the message that norowset was returned. In a way, that explains the issue with theActive-X script. BUT, I know darn well it returns data. It returns438 rows of data when I run this in Query Analyser.So, here's my question....how could that be? Is there some issue thatDTS packages have with temporary tables? I do use a couple in theStored Procedure. Without having to post the stored procedure andtables, etc. could someone let me know if they've run into somethinglike this before?Thanks,Jennifer

View 1 Replies View Related

Unexpected Casting With Sum && Coalesce

Sep 28, 2006

If I have an SQL query which returns an aggregate of several decimal fieldslike so:(sum(COALESCE(myDecimal1, 0)+sum(COALESCE(myDecimal2, 0)+sum(COALESCE(myDecimal3, 0)) as MyTotalI get an rounded integer in MyTotal.However, if I do the following:sum(COALESCE(myDecimal1, 0)+COALESCE(myDecimal1, 0)+COALESCE(myDecimal1, 0)) as MyTotalI get a (proper) decimal value.Does anyone know why the first case returns an Integer?- Don

View 4 Replies View Related

Unexpected SQL Syntax Error!

Jul 20, 2005

I posted this to microsoft.public.sqlserver.programming, but no onecould answer my question. So I think it is a good place to re-post myquestion here.My question:I found that if you do not include any effective SQL statement betweenBEGIN/END block, SQL Server 2000 Query Analyzer will think it is anerror:Server: Msg 156, Level 15, State 1, Line 6Incorrect syntax near the keyword 'end'.if 1=1select getdate()elsebegin--select 'ok'endIs this behavior a SQL standard or simply a M$ standard glitch?

View 5 Replies View Related

Unexpected Results In Query

Sep 21, 2007

Hi,

I'm trying to run what I thought was a relatively straightforward query to find all entries from one table that don't appear in another table:

select * from Search_Suggestion where Suggestion not in (select distinct C106 from Search_Log)

The Search_Suggestion table contains 4060 entries and the Search_Log table contains 142,000+ distinct entries.

From running a similar query using 'in' instead of 'not in' I find that there are 3778 matches between the two tables would logic which suggest leave 282 that don't exist in the Search_Log table.

However....when I run the above query it returns no records.

I've tried changing it around and have also tried using temp tables but each time I still get no records.

Any help wouldbe greatly appreciated.

Kind regards,
Steve

View 3 Replies View Related

ReportserverTempDB Grows Unexpected

Apr 8, 2008



Hi SSRS Experts

We encounter the problem, that a reportservertempdb grows extremly large... the sessiondata and snapshotdata tables are about 10gb each at the moment and keep growing and growing...
The CleanupCycleMinutes Configuration is set to default=10. We are not taking snapshots of our reports.
Shouldnt those tables be cleaned up every 10minutes with this setting?

What can we do to stop this database growing? is truncating those tables on a weekly base a solution?
We are using SQL Server Reporting Services 2005 SP2 with Cumulative Hotfix Package 5 (Build 3215).

Thanks for your answers...

Kind Regards,

Roger

View 10 Replies View Related

SQLNumResultCols Returns Unexpected Value

Feb 23, 2007

Anyone know why SQLNumResultCols would return a different value for ColumnCountPtr in ODBC 3.0 than in ODBC 2.0?

The only difference in our test program is that we set a different value for the SQL_ATTR_ODBC_VERSION attribute via SQLSetEnvAttr. When we set it to SQL_OV_ODBC2, SQLNumResultCols returns the expected value (10). When we set it to SQL_OV_ODBC3, SQLNumResultCols returns an unexpected value (0).

View 6 Replies View Related

Unexpected Existing Transaction - Error

Aug 13, 2007

 Hi,My code worked fine before i placed "SqlTransaction" command in my code. Now it is showing "Unexpected existing transaction." Please tell me where I am going wrong. My Code:  



























































protected void
Page_Load(object sender, EventArgs e)    {        using (SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["Mfund_String"].ConnectionString))        {             con.Open();             using (SqlConnection destinationConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["Mfund_String"].ConnectionString))             {                 destinationConnection.Open();                 using (SqlTransaction transaction =
destinationConnection.BeginTransaction())                 {                     SqlCommand DelCmd = new
SqlCommand("delete
from mfund_data", con);                     DelCmd.ExecuteNonQuery();                         using (SqlBulkCopy bulkCopy = new
SqlBulkCopy(destinationConnection))                         {                             bulkCopy.DestinationTableName = "mfund_data";                             try                             {                                 bulkCopy.WriteToServer(CreateDataTableFromFile());                                 transaction.Commit();                              }                             catch
(Exception ex)                             {                                 transaction.Rollback();                                 Response.Write(ex.Message);                             }                         }                     }                     destinationConnection.Close();                   }                 con.Close();             }             }Regards,Jagadeesh 

 

View 2 Replies View Related

Unexpected Existing Transaction With SqlBulkCopy

Oct 17, 2007

I have programmatically created a SqlConnection that begins a SqlTransaction.  During the first part of this SqlTransaction, the contents of a table are deleted.  The next part uses the SqlBulkCopy object to copy data from another database (in the form of a DataTable).  The delete goes through fine, but the SqlBulkCopy always generates a SqlException with the message "Unexpected existing transaction."  I cannot think of anything I am doing wrong. 
The code looks at an XML file for instructions on each transaction.  Each transaction is composed of tasks.  Each task will pull data from a different type of database (MVR.Command is a Factory Database object).  Please view the code below and tell me if you can spot what I am doing wrong:
 using (SqlConnection destinationConnection = new SqlConnection(MVR.ConnectionSource.GetConnectionString(destinationServiceName)))
{
destinationConnection.Open();

using (SqlTransaction transaction = destinationConnection.BeginTransaction(IsolationLevel.Snapshot, "Transport"))
{
transaction.Save("Beginning");

int totalTasks = 0;
int successfulTasks = 0;

foreach (XmlNode taskNode in transactionNode.SelectNodes("Tasks/Task"))
{
totalTasks += 1;

string sourceServiceName = taskNode.Attributes["sourceServiceName"].Value;
string destinationTablename = taskNode.Attributes["destinationTablename"].Value;
string query = taskNode.InnerText;

MVR.Command source = MVR.ConnectionSource.GetCommand(sourceServiceName);
source.CommandType = CommandType.Text;
source.CommandText = query;

DataTable sourceData = source.ExecuteDataTable();

try
{
// Prepare the destination table (delete everything)
int rowsDeleted = new SqlCommand("delete from " + destinationTablename, destinationConnection, transaction).ExecuteNonQuery();

using (SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection))
{
bulkCopy.DestinationTableName = destinationTablename;

bulkCopy.NotifyAfter = 1000;
bulkCopy.WriteToServer(sourceData);
bulkCopy.Close();

successfulTasks += 1;

// Log success
}
}
catch (Exception ex)
{
// Log failure
}
}

transaction.Save("End");

// Based on the success of all tasks, either commit or rollback
if (successfulTasks == totalTasks)
{
transaction.Commit();
}
else
{
transaction.Rollback();
}
}

destinationConnection.Close();

 

View 2 Replies View Related

SQL Msg: &#34;an Unexpected Error Happened During This Operation&#34;

Nov 1, 2000

I have W2K Adv, SQL 7 Enterprise in a workgroup with mixed security. The SQL installation is an almost entirely default install.

At the console, in SQL Enterprise Manager, when I select open a database, open tables, select a table, open table, and select all rows the system displays "an unexpected error happened during this operation". As far as I know this has never worked on this installation.

The error occurs with every logon account (including sa and local administrator accounts), both the "all rows or top row" options, every table, every database (including the customers database and the Northwind database).

I have tried adding administrators and accounts as users of the databases etc. and given the accounts all the permissions I can dream up.

There are no interesting messages in the event viewer. The SQL agent is running.

Technet found two documents but not related to the problem.

I can run SQL Analyzer and run "select * from table_name". That works on the Northwind and customer database tables - every time.

Colleagues with other installations do not get the error, and their systems return the rows correctly.

If any of you can help, I'd really appreciate it.

View 3 Replies View Related

Jobs - Unexpected Slow Performance

Mar 7, 2003

DECLARE @num int
SET @num = 0
DECLARE @tableVariable table(ColA int, ColB decimal(18,4))
WHILE @num < 1000
BEGIN
INSERT INTO @tableVariable VALUES (2, 10.56)
SET @num = @num +1
ENDWhen this code is run in SQL Server 2000 Query Analyzer it commits in less than 1 second.
The same code run as a SQLServerAgent job takes 16 seconds.

Similar behaviour appears if INSERT statement is substituted with UPDATE.

SELECT statement runs equally nice on both alternatives.

Has anybody got an idea what might be the reason for slow execution of INSERT and UPDATE in a job?

Thanks,
teetjott

View 2 Replies View Related

Unexpected EOF Encountered In BCP Data-file.

Nov 1, 1999

I'm getting this message on a replication distribution task after a successful SYNC task. The exact error message is:
" Unexpected EOF encountered in BCP data-file.Failed while bulk copying into '<table name>' "
I'm running SQL 6.5 Sp4.
I tried recreating the article, resyncing and redistributing, with no luck.
Is there anything I can do to fix this? Any help would be appreciated

View 1 Replies View Related

DBCC DBREINDEX - Unexpected Results

Jul 28, 2004

I have lost the reference but I read somewhere that when running DBCC DBREINDEX against a clustered index, all the secondary indexes on the table are automatically re-indexed as well. I did a test of this on a small table and it seemed to confirm this. However, now I've put this into practice, I am finding that it doesn't seem to work this way. I noticed that having run DBCC DBREINDEX against a table's clustered index (DBCC DBREINDEX ('tablename', 'clusteredIndexName', fill_factor)), the secondary indexes were not automatically re-indexed - as born out by the fact that they remained badly fragmented.

First of all, do the dba's who read this beleive it is correct that DBCC DBREINDEX run against a clustered index will automatically rebuild the secondary indexes too? If so, why wouldn't it work in all cases?

Clive

View 12 Replies View Related

DBCC DBREINDEX Unexpected Results

Aug 9, 2004

Normally, after I use DBCC DBREINDEX, I can be sure that Scan Density on a clustered or non-clustered index is very good - eg. 99% or 100%. However, I have one database where there are a number of indexes that are not showing any improvement in Scan Density after running DBCC DBREINDEX. In on case, a clustered index, I run it on two days in succession and Scan Density actually go worse! Can anyone give me a reason for this? Can anyone suggest how to fix it?

Clive

View 1 Replies View Related

Unexpected Outcome When Exporting Views..

Jan 30, 2004

Something weird happened tonight.. here's the deal. I have two databases exactly the same.. one is for dev, one's for live data.

Anyway, the live DB had an outdated view.. so I exported from the dev DB to the live.. just copying that one view over (using "copy objects" in the export DTS wizard). Very oddly, it actually copied over the data in the tables referenced by the view! Not good, cuz I told my coworkers I'd leave the data in the tables alone :( How do I copy a view over, but just the view definition, and NOT the actual table data??

Thanks

View 4 Replies View Related







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