Strange SqlBulkCopy Exception With SQL Server 2005

Dec 10, 2006

Hello,

Wondering if anyone can help with a strange exception thrown while using the SqlBulkCopy class. I am using the class to transfer records from a DataTable in memory (approx 11,000 rows) into a SQL Server 2005 table.

Initially, the WriteToServer method was timing out a la KB913177 (http://support.microsoft.com/default.aspx/kb/913177), however I downloaded the hotfix, which eliminated this issue.

Now, I get a new exception thrown, as follows:

System.Data.SqlClient.SqlException: OLE DB provider 'STREAM' for linked server '(null)' returned invalid data for column '[!BulkInsert].Power_Avg'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal()
at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount)
at System.Data.SqlClient.SqlBulkCopy.WriteToServer(DataTable table, DataRowState rowState)
at System.Data.SqlClient.SqlBulkCopy.WriteToServer(DataTable table)

I can't see anything wrong with the data I have. The column "Power_Avg" is of type "float". When forming the DataTable, I cast my data to float expcilitly in C#.

Other things to know:

I am using SQL Server Express (2005)
This same code works fine with SQL Server 2000 (MSDE)
My code makes all modifications inside a single transaction of type "Snapshot" (I have activated SNAPSHOT READ COMMITTED in the database)
I have not activated MARS in the connection

Any ideas / suggestions?

Thanks,

Nick

View 7 Replies


ADVERTISEMENT

SQLBulkCopy In A C# App Causes SQL Server 2005 To Lock Up

May 16, 2007

I have written an app that will allow you to send a query to Teradata, return the results into a Reader and then Bulk Copy that data into SQL Server 2005.



If the query results in a large dataset (ie 20,000,000 rows) is processed then while that data is being bulk copied into SQL Server, using the SQLBulkCopy class, then it prevents users on other computers from logging into SQL Server Management Studio.

Those that are already logged in are shut down also. Everything appears fine to the users but queries do not finish running.



Everything immediatly starts working as normal when either my program finishes or I shut down my program.



Is there any type of property to the SQLBulkCopy class or any other function that will prevent Management Studio from locking up?



Thanks

Robert

View 2 Replies View Related

Strange Null Exception

Jan 1, 2007

Using vb express and sql express.



I add selected rows from table1 to table2 have all the code working for that. When updating the changes I noticed that for somereason the CustomerID field was autoincrementing. Can't have that. Changed the properties to autoincrement false. Now I get an exception saying cannot add null to column. Problem is, the field is not null. When i copy the row the "CustomerID" value is 2. For some reason it is not seeing this field.

The CustomeID field is not a key. I don't want it set to autoincrement as it is in a table set on the many side of a one to many relation. The field is not set to read only. If I do set it to autoincrement it sees the field fine and updates the table with autoincrementing numbers.



Any help would be appreciated.



View 2 Replies View Related

Strange Exception - Batch Update

Apr 19, 2007

Can anyone help me understand what this means:




Code Snippet

java.sql.BatchUpdateException: com.microsoft.sqlserver.jdbc.SQLServerException: The IOBuffer.process operation returned an unknown packet type:0. Index:41. End:83.TDS_DONEINPROC(-1) TDS_DONEPROC(-2) TDS_DONE(-3) TDS_COLMETADATA(-127)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(Unknown Source)




I'm trying to do a very simple batch update.

View 7 Replies View Related

SQL Server 2005 Transaction Exception

Apr 19, 2007

Dear All,
I am getting SQL Server 2005 unable to resume transaction Exception


Please guide and help


Thanks,
Waheed.

View 2 Replies View Related

SQL Server 2005 Timeout Expired Exception

Feb 13, 2006

Hi,

I have a program in C# that I used to run on Visual Studio 2000 and SQL Server 2000 without any problem.

Now I upgrade to VS2005 and SQL Server 2005 and get and exception while

insert via SqlCommand.ExecuteNonQuery(). the insert is after many inserts to the same table by that program. the CommandTimeout is set to 600 (in the 2000 version I never had to change the default value of 30 seconds).

the insert is through a connection that is kept open throughout the program for more than 30 minutes

the exception message is:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

the trace is:

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()


Thanks for your help !

View 11 Replies View Related

Strange Problem Using CTE In Sql Server 2005

Nov 27, 2006

I am trying to use a condition in a query with CTE but I got an error.It is simple enough but I just cannot get it work. Any help will be greatly appreciated!
Msg 156, Level 15, State 1, Line 8Incorrect syntax near the keyword 'if'.  declare @i as int
set @i=1;
with CTE_A as
(
select 'B'
)

if @i=1 ---this part get problem
select * from CTE_A
else
select 'B'

 

View 2 Replies View Related

STRANGE PROBLEM IN SQL SERVER 2005

Jun 23, 2008

Dear Friends

I am trying to create a trriger in sql server 2005 but it gives me error. i am unable to understand the problem . here is detail about it

Database name :- Orders

table name :- Currency_Master

Columns are :- Currency_Symbol, Currency_Name, Value_in_Rs

The create trigger query is


CREATE TRIGGER FOR ORDERS ON CURRENCY_MASTER
AFTER INSERT

AS SELECT 'CURRENCY_SyMBOL'


Can any body tell that why it gives an error and how to rectify it.

Thanks in advance.

Shivpreet2k1

View 5 Replies View Related

Strange SQL Server 2005 SP Issue

Sep 15, 2006

We have a stored proc that accepts a date and uses that date in a filter. This procedure worked fine for a couple of weeks then started hanging. Basically, this date parameter is used in a where clause.

Our workaround: when we declare a new variable, set it equal to the parameter, then use the declared variable - that fixes it. Take away the declared variable and use the parameter instead and the proc chokes. But the paremeter and the declare variable are both datetime typed. Weird.

We are worried (partly because it worked without hanging for a while) that we are experiencing a larger issue. We are reporting off a database we denormalize and populate nightly with transactional data. A poor man's warehouse if you will, staging the data in a fast reporting format with the prep done each night. This database is wiped and re-populated each night. We have been testing this process with the same source data, so we are not growing our data at all (net result at end of each night is same data as previous day).

I think the source code here is overkill, but I enclosed the proc anyway. The way it is written below, it hangs. Replace these two uses of @AsOf in the proc with @test and the procedure almost instantly returns data. There is a third use of @AsOf that doesn't affect the issue one way or the other. This line is where the replacement fixes the problem:

--Breaks
Where (OpenedDt < DateAdd(day, 1, @AsOf) or ClosedDt < DateAdd(day, 1, @AsOf)) and (PlanType = @PlanType or @PlanType is null)

--Fixed
Where (OpenedDt < DateAdd(day, 1, @test) or ClosedDt < DateAdd(day, 1, @test)) and (PlanType = @PlanType or @PlanType is null)

If anyone has experienced this or knows some other symptoms to check for, we are all ears. This is scaring us because otherwise we have a working system on our hands and are near a delivery point. Help would be greatly appreciated.

Here is the complete proc...

ALTER PROCEDURE [dbo].[ClaimCountsByLineOfBusiness]
-- Add the parameters for the stored procedure here
@AsOf datetime,
@PlanType varchar(50)

AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

DECLARE @DataFreshness datetime
Select @DataFreshness = DataFreshness From metaReportList Where StoredProcedure = 'ClaimCountsByLineOfBusiness'

If @AsOf is null
SET @AsOf = Convert(datetime, Convert(varchar(10), GetDate(), 101))

DECLARE @test datetime
SET @test = @AsOf

-- Insert statements for procedure here
Select PolicyGroup, Lines,
SUM(CASE WHEN HasPayment = 1 and OpenClosed <= 0 THEN 1 ELSE 0 END) as ClosedClaimswithPayment,
SUM(CASE WHEN HasPayment = 0 and OpenClosed <= 0 THEN 1 ELSE 0 END) as ClosedClaimswithoutPayment,
SUM(CASE WHEN OpenClosed > 0 THEN 1 ELSE 0 END) as ClaimsOpen,
Count(ClaimSummary.ClaimNumber) as ClaimsReported,
AccidentYear, ReportingYear,
--Return the value of the parameters in a friendly way (if null)
Convert(varchar(10), @Asof, 101) as AsOfParameter,
IsNull(@PlanType, 'any value') as PlanTypeParameter,
@DataFreshness as DataFreshness

FROM
(Select ClaimNumber, Max(OpenedDt) as OpenedDt, HasPayment, PolicyGroup, Lines, AccidentYear, ReportingYear
From dbo.factClaimSummary
Where (OpenedDt < DateAdd(day, 1, @AsOf) or ClosedDt < DateAdd(day, 1, @AsOf)) and (PlanType = @PlanType or @PlanType is null)
Group by ClaimNumber, HasPayment, PolicyGroup, Lines, AccidentYear, ReportingYear) as ClaimSummary

INNER JOIN

(Select ClaimNumber, SUM(CASE WHEN OpenedDt is not null THEN 1 ELSE -1 END) as OpenClosed
From dbo.factClaimSummary
Group by claimnumber) Status ON ClaimSummary.ClaimNumber = Status.ClaimNumber

Group by PolicyGroup, Lines, AccidentYear, ReportingYear
Order by PolicyGroup, Lines
END

View 2 Replies View Related

SqlConnection Access Is Denied Exception With SQL Server 2005

Feb 21, 2006

Hi,I have a SqlConnection object with connection string, "Data Source=server1;Initial Catalog=CDCollection;User Id=joe;Password=11111."For User ID, I created a new user "joe" in the Management Studio.I tried to use this user, but sqlconnection threw an exception stating access was denied.I noticed that SQL Server 2005 has user accounts that you can create for the server and for the database, but I am confused by this.  How can a create a non-sa user account that I can give to the SQLConnection object that will work?  Do I need to create a user for the server and the same user for the database CDCollection?  I am not all familiar with SQL Server administration.Any help or leads would be appreciated.

View 3 Replies View Related

Strange Login Issue With SQL Server 2005 Mirroring

Mar 27, 2008

Hi,
we have setup synchronous mirroring with witness server.We ran into problem when we stoped the SQLService of Primary Server. Failover Occured and Witness Server made Mirror Server Primary.

The User assosciated with the Database become Orphaned and no one is able to connect to the Database .
We recove login failed error for all login for mirrored database.
We have to manually run the below comand and reset the password for each login.

1.To Detect Orphaned Users
sp_change_users_login @Action='Report';
2.To Resolve an Orphaned User
sp_change_users_login @Action='update_one', @UserNamePattern='<database_user>', @LoginName='<login_name>';
GO

Please let me know why sql server mirroring show such strange behavior. If we manually failove every thing work fine.

Regards
Sufian

View 3 Replies View Related

'((System.Exception)($exception)).Message' Threw An Exception Of Type 'System.NotSupportedException'

Jan 16, 2008

Greetings everyone, I am attempting to build my first application using Microsofts Sql databases. It is a Windows Mobile application so I am using Sql Server Compact 3.5 with Visual Studio 2008 Beta 2. When I try and insert a new row into one of my tables, the app throws the error message shown in the title of this topic.
'((System.Exception)($exception)).Message' threw an exception of type 'System.NotSupportedException'



My table has 4 columns (i have since changed my FavoriteAccount datatype from bit to Integer)
http://i85.photobucket.com/albums/k71/Scionwest/table.jpg

Account type will either be "Checking" or "Savings" when a new row is added, the user will select what they want from a combo box.

Next is a snap shot of my startup form.
http://i85.photobucket.com/albums/k71/Scionwest/form.jpg



Where it says "Favorite Account: None" in the top panel, I am using a link label. When a user clicks "None" it will go to a account creation wizard, and set the first account as it's primary/favorite. As more accounts are added the user can select which will be his/her primary/favorite. For now I am just creating a sample account when the label is clicked in an attempt to get something working. Below is the code used.


private void lnkFavoriteAccount_Click(object sender, EventArgs e)

{

FinancesDataSet.BankAccountRow account = this.financesDataSet.BankAccount.NewBankAccountRow();

account.Name = "MyBank Checking Account";

account.AccountType = "Checking";

account.Balance = Convert.ToDecimal("15.03");

account.FavoriteAccount = 1;//datatype is an integer, I have changed it since I took the screenshot.

financesDataSet.BankAccount.Rows.Add(account);
//The next three lines where added while I was trying to get this to work.
//I don't know if I really need them or not, I receive the error regardless if these are here or not.



this.bankAccountTableAdapter1.Update(financesDataSet);

this.financesDataSet.AcceptChanges();

refreshDatabase();

}


the refreshDatabase() code is here:


private void refreshDatabase()

{

this.bankAccountTableAdapter1.Fill(this.financesDataSet.BankAccount);

//Aquire a count of accounts the user has

int numAccounts = financesDataSet.BankAccount.Count;

//Loop through each account and see which one is the primary.

for (int num = 0; num != numAccounts; num++)

{
//Works ok in frmMain_Load, but when my lnkFavoriteAccount_click calls this, it throws the error.

if (this.financesDataSet.BankAccount[num].FavoriteAccount == 1)

{
//Display the primary account on our home page. User can click the link label & be taken to their account register.

this.lnkFavoriteAccount.Text = this.financesDataSet.BankAccount[num].Name.ToString();

this.lnkFavoriteFunds.Text = this.financesDataSet.BankAccount[num].Balance.ToString();

break;

}

}

}


and my form_load code

private void frmMain_Load(object sender, EventArgs e)

{

refreshDatabase();

}


So, when I click on the lnkFavoriteAccount label, and my new row gets added, the app stops at the following line in my DataSet.Designer

[global:ystem.Diagnostics.DebuggerNonUserCodeAttribute()]

public byte FavoriteAccount {

get {

try {

return ((byte)(this[this.tableBankAccount.FavoriteAccountColumn]));

}

catch (global:ystem.InvalidCastException e) {
//Stops at the following line, this error was caused by 'if (this.financesDataSet.BankAccount[num].FavoriteAccount == 1)'

throw new global:ystem.Data.StrongTypingException("The value for column 'FavoriteAccount' in table 'BankAccount' is DBNull.", e);

}

}

set {

this[this.tableBankAccount.FavoriteAccountColumn] = value;

}

}


I have no idea what I am doing wrong, all of the code I used I retreived from Microsofts help documentation included with VS2008. I have tried used my TableAdapter.Insert() method and it still failed when it got to

if (this.financesDataSet.BankAccount[num].FavoriteAccount == 1)

in my refreshDatabase() method it still failed.

When I look, the data has been added into the database, it's just when I try to retreive it now, it bails on me. Am I retreiving the information wrong?

Thanks for any help you guys can offer.

Johnathon

View 1 Replies View Related

Import Excel Spreadsheet Data Into SQL Server Database Table Using SqlBulkCopy

Dec 13, 2007

 
Hi, I'm a Student, and since a few months ago I'm learning JAVA. I'm creating an application to call and compare times. For this I create in Excel a time table which is quite big and it would be a lot of typing work to input one by one the data in each cell in SQL Server, considering that I have to create 8 more tables. I was able to retreive the data from excel usin the JXL API of JAVA but it doesn't give all the funtions to perform math operations as JDBC. That's why I need to move the tables from Excel to SQL.
I found this site http://davidhayden.com/blog/dave/archive/2006/05/31/2976.aspx which gives a code to do so, but I guess that some heathers are missing or maybe I don't know which compiler to use to run that code, I would like you help to identify which compiler use to run that code or if there is some vital piece of code missing.// Connection String to Excel Workbook
string excelConnectionString = @"Provider=Microsoft .Jet.OLEDB.4.0;Data Source=Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;""";

// Create Connection to Excel Workbook
using (OleDbConnection connection = new OleDbConnection(excelConnectionString))
{
OleDbCommand command = new OleDbCommand ("Select ID,Data FROM [Data$]", connection);

connection.Open();

// Create DbDataReader to Data Worksheet
using (DbDataReader dr = command.ExecuteReader())
{
// SQL Server Connection String
string sqlConnectionString = "Data Source=.; Initial Catalog=Test;Integrated Security=True";

// Bulk Copy to SQL Server
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(sqlConnectionString))
{
bulkCopy.DestinationTableName = "ExcelData";
bulkCopy.WriteToServer(dr);
}
}
}
On the other hand in this forum I that someelse use that link but implements a totally different code which I'm not able to compile also http://forums.asp.net/p/1110412/2057095.aspx#2057095. It seems this code works as I was able to read, but I do not know which language is used.
Dim excelConnectionString As String = "Provider=Microsoft .Jet.OLEDB.4.0;Data Source=Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;"""
 
' Using
 
Dim connection As OleDbConnection = New OleDbConnection(excelConnectionString)
 
Try
 
Dim command As OleDbCommand = New OleDbCommand("Select ID,Data FROM [Data$]", connection)
connection.Open()
 
' Using
 
Dim dr As DbDataReader = command.ExecuteReader
 
Try
 
Dim sqlConnectionString As String = WebConfigurationManager.ConnectionStrings("CampaignEnterpriseConnectionString").ConnectionString
 
' Using
 
Dim bulkCopy As SqlBulkCopy = New SqlBulkCopy(sqlConnectionString)
 
Try
bulkCopy.DestinationTableName =
"ExcelData"
bulkCopy.WriteToServer(dr)
 
Finally
 
CType(bulkCopy, IDisposable).Dispose()
 
End Try
 
Finally
 
CType(dr, IDisposable).Dispose()
 
End Try
 
Finally
 
CType(connection, IDisposable).Dispose()
 
End Try
 
Catch ex As Exception
 
End Try
The Compilers I have are: Eclipse, Netbeans, MS Visual C++ Express Edition and MS Visual C# Express Edition. In MS Visual C++
Thanks for your help.
 Regads,
Robert.
 

View 4 Replies View Related

The Script Threw An Exception: Exception Of Type 'System.OutOfMemoryException' Was Thrown.

Jan 31, 2007

Hi,

I got an strange problem with one of my packages.

When running the package in VisualStudio it runs properly, but if I let this package run as part of an SQL-Server Agent job, I got the message "The script threw an exception: Exception of type 'System.OutOfMemoryException' was thrown." on my log and the package ends up with an error.

Both times it is exactly the same package on the same server, so I don't know how the debug or even if there is anything I need to debug?

Regards,

Jan

View 2 Replies View Related

SQL 2005 Unhandled Exception Error

Nov 23, 2005

Hi,I have installed SQL 2005 RTM on a new server and I keep getting thiserror (described below) quite frequently. Was wondering if anyone has aclue on what's happening here. I tried googling but no success!This generally happens when I am browsing the tree in Object explorerin SQL 2005 Management Studio. I can be doing anything - like viewingdatabases, or viewing table list or viewing stored procedure list, etc.I get the following error (screenshot in URL link)http://img5.imageshack.us/img5/6274/sql2005error3vt.jpgWhen this happens and I click Continue, I can work in Management Studiolike queries, etc. - the summary window appears blank though. It doeshowever refresh the count of items in the list but the main windowdisplays no table list or view list or sp list (whatever the case maybe). Screen shot link:http://img5.imageshack.us/img5/6076...05error21yu.jpgAny ideas???Thanks in advance for all your help!VishalText if message when I click on the Details Button:See the end of this message for details on invokingjust-in-time (JIT) debugging instead of this dialog box.************** Exception Text **************System.ArgumentOutOfRangeException: InvalidArgument=Value of '5' is notvalid for 'index'.Parameter name: indexatSystem.Windows.Forms.ListView.ListViewItemCollecti on.get_Item(Int32index)at System.Windows.Forms.ListView.set_VirtualListSize( Int32 value)atMicrosoft.SqlServer.Management.UI.VSIntegration.Ap pIDPackage.RightPaneListViewer.set_VirtualListSize (Int32value)atMicrosoft.SqlServer.Management.UI.VSIntegration.Ap pIDPackage.RightPaneListViewer.PopulateView()atMicrosoft.SqlServer.Management.UI.VSIntegration.Ap pIDPackage.RightPaneListViewer.Microsoft.SqlServer .Management.UI.VSIntegration.AppIDPackage.IReportV iew.SetReportSource(ReportSourcereportSource)atMicrosoft.SqlServer.Management.UI.VSIntegration.Ap pIDPackage.RightPaneControl.InternalSetReportSourc e(ReportSourcereportSource, IReportView newView)************** Loaded Assemblies **************mscorlibAssembly Version: 2.0.0.0Win32 Version: 2.0.50727.42 (RTM.050727-4200)CodeBase:file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll----------------------------------------AppIDPackageAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/Program%20Files/Microsoft%20SQL%20Server/90/Tools/Binn/VSShell/Common7/IDE/AppIDPackage.DLL----------------------------------------SystemAssembly Version: 2.0.0.0Win32 Version: 2.0.50727.42 (RTM.050727-4200)CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll----------------------------------------Microsoft.SqlServer.SqlTools.VSIntegrationAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/Program%20Files/Microsoft%20SQL%20Server/90/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.SqlTools.VSIntegration.DLL----------------------------------------Microsoft.VisualStudio.Shell.InteropAssembly Version: 7.1.40304.0Win32 Version: 7.0.4054CodeBase:file:///C:/WINDOWS/assembly/GAC/Microsoft.VisualStudio.Shell.Interop/7.1.40304.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Shell.Interop.dll----------------------------------------Microsoft.VisualStudio.OLE.InteropAssembly Version: 7.1.40304.0Win32 Version: 7.0.4054CodeBase:file:///C:/WINDOWS/assembly/GAC/Microsoft.VisualStudio.OLE.Interop/7.1.40304.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.OLE.Interop.dll----------------------------------------System.Windows.FormsAssembly Version: 2.0.0.0Win32 Version: 2.0.50727.42 (RTM.050727-4200)CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll----------------------------------------System.DrawingAssembly Version: 2.0.0.0Win32 Version: 2.0.50727.42 (RTM.050727-4200)CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll----------------------------------------Microsoft.SqlServer.SqlTDiagMAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.SqlServer.SqlTDiagM/9.0.242.0__89845dcd8080cc91/Microsoft.SqlServer.SqlTDiagM.dll----------------------------------------Microsoft.DataWarehouse.SQMAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/Program%20Files/Microsoft%20SQL%20Server/90/Tools/Binn/VSShell/Common7/IDE/Microsoft.DataWarehouse.SQM.DLL----------------------------------------Microsoft.SqlServer.InstapiAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.SqlServer.Instapi/9.0.242.0__89845dcd8080cc91/Microsoft.SqlServer.Instapi.dll----------------------------------------ObjectExplorerAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/Program%20Files/Microsoft%20SQL%20Server/90/Tools/Binn/VSShell/Common7/IDE/ObjectExplorer.DLL----------------------------------------ConnectionDlgAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/Program%20Files/Microsoft%20SQL%20Server/90/Tools/Binn/VSShell/Common7/IDE/ConnectionDlg.DLL----------------------------------------SqlWorkbench.InterfacesAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/Program%20Files/Microsoft%20SQL%20Server/90/Tools/Binn/VSShell/Common7/IDE/SqlWorkbench.Interfaces.DLL----------------------------------------Microsoft.SqlServer.CustomControlsAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.SqlServer.CustomControls/9.0.242.0__89845dcd8080cc91/Microsoft.SqlServer.CustomControls.dll----------------------------------------AccessibilityAssembly Version: 2.0.0.0Win32 Version: 2.0.50727.42 (RTM.050727-4200)CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll----------------------------------------SqlMgmtAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/Program%20Files/Microsoft%20SQL%20Server/90/Tools/Binn/VSShell/Common7/IDE/SqlMgmt.DLL----------------------------------------Microsoft.SqlServer.RegSvrEnumAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.SqlServer.RegSvrEnum/9.0.242.0__89845dcd8080cc91/Microsoft.SqlServer.RegSvrEnum.dll----------------------------------------EnvDTEAssembly Version: 8.0.0.0Win32 Version: 8.0.50727.42 (RTM.050727-4200)CodeBase:file:///C:/WINDOWS/assembly/GAC/EnvDTE/8.0.0.0__b03f5f7f11d50a3a/EnvDTE.dll----------------------------------------Microsoft.NetEnterpriseServers.ExceptionMessageBox Assembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.NetEnterpriseServers.ExceptionMessageBox /9.0.242.0__89845dcd8080cc91/Microsoft.NetEnterpriseServers.ExceptionMessageBox .dll----------------------------------------System.DataAssembly Version: 2.0.0.0Win32 Version: 2.0.50727.42 (RTM.050727-4200)CodeBase:file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll----------------------------------------Microsoft.SqlServer.ConnectionInfoAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.SqlServer.ConnectionInfo/9.0.242.0__89845dcd8080cc91/Microsoft.SqlServer.ConnectionInfo.dll----------------------------------------System.XmlAssembly Version: 2.0.0.0Win32 Version: 2.0.50727.42 (RTM.050727-4200)CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll----------------------------------------Microsoft.SqlServer.SmoEnumAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.SqlServer.SmoEnum/9.0.242.0__89845dcd8080cc91/Microsoft.SqlServer.SmoEnum.dll----------------------------------------System.ConfigurationAssembly Version: 2.0.0.0Win32 Version: 2.0.50727.42 (RTM.050727-4200)CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll----------------------------------------System.TransactionsAssembly Version: 2.0.0.0Win32 Version: 2.0.50727.42 (RTM.050727-4200)CodeBase:file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll----------------------------------------System.EnterpriseServicesAssembly Version: 2.0.0.0Win32 Version: 2.0.50727.42 (RTM.050727-4200)CodeBase:file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll----------------------------------------Microsoft.SqlServer.SmoAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.SqlServer.Smo/9.0.242.0__89845dcd8080cc91/Microsoft.SqlServer.Smo.dll----------------------------------------Microsoft.SqlServer.SqlEnumAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.SqlServer.SqlEnum/9.0.242.0__89845dcd8080cc91/Microsoft.SqlServer.SqlEnum.dll----------------------------------------Microsoft.SqlServer.BatchParserAssembly Version: 9.0.242.0Win32 Version: 2005.090.1399.00CodeBase:file:///C:/WINDOWS/assembly/GAC_32/Microsoft.SqlServer.BatchParser/9.0.242.0__89845dcd8080cc91/Microsoft.SqlServer.BatchParser.dll----------------------------------------msvcm80Assembly Version: 8.0.50608.0Win32 Version: 8.00.50727.42CodeBase:file:///C:/WINDOWS/WinSxS/x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727. 42_x-ww_0de06acd/msvcm80.dll----------------------------------------ObjectExplorerReplicationAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/Program%20Files/Microsoft%20SQL%20Server/90/Tools/Binn/VSShell/Common7/IDE/ObjectExplorerReplication.DLL----------------------------------------Microsoft.ReportViewer.WinFormsAssembly Version: 8.0.0.0Win32 Version: 8.0.50727.42CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.ReportViewer.WinForms/8.0.0.0__b03f5f7f11d50a3a/Microsoft.ReportViewer.WinForms.dll----------------------------------------System.ManagementAssembly Version: 2.0.0.0Win32 Version: 2.0.50727.42 (RTM.050727-4200)CodeBase:file:///C:/WINDOWS/assembly/GAC_MSIL/System.Management/2.0.0.0__b03f5f7f11d50a3a/System.Management.dll----------------------------------------SQLEditorsAssembly Version: 9.0.242.0Win32 Version: 9.00.1399.00CodeBase:file:///C:/Program%20Files/Microsoft%20SQL%20Server/90/Tools/Binn/VSShell/Common7/IDE/SQLEditors.DLL----------------------------------------Microsoft.VisualStudio.TextManager.InteropAssembly Version: 7.1.40304.0Win32 Version: 7.0.4054CodeBase:file:///C:/WINDOWS/assembly/GAC/Microsoft.VisualStudio.TextManager.Interop/7.1.40304.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.TextManager.Interop.dll----------------------------------------************** JIT Debugging **************To enable just-in-time (JIT) debugging, the .config file for thisapplication or computer (machine.config) must have thejitDebugging value set in the system.windows.forms section.The application must also be compiled with debuggingenabled.For example:<configuration><system.windows.forms jitDebugging="true" /></configuration>When JIT debugging is enabled, any unhandled exceptionwill be sent to the JIT debugger registered on the computerrather than be handled by this dialog box.

View 1 Replies View Related

Exception Error When Previewing Report (VS 2005 SP1)

May 12, 2008

I am creating a report in VS 2005 SP1 (all updates applied) on a Windows 2003 Server with 8GB of RAM. When I preview the report (about 120,000 records) it locks up my machine for about 5 minutes and then gives an error:

An error occurred during local report processing.
An error has occurred during report processing.
Exception of type 'System.OutOfMemoryException' was thrown.

This report has a somewhat complex query, but when I deploy the report to the server (Reporting Services 2005) it runs fine. I just hate to deploy the report each time I want to preview it. Is there a setting for VS that I can change to increase memory? Or is there something else I need to check?

Thank you for any assistance!

Bill

View 1 Replies View Related

Strange Difference Between Sql 2002 And 2005.

Dec 5, 2007

hi,
I just realized that this must be a difference between sql server 2000 and 2005.
For example, the query is like this:
declare @n int
set @n = -1
select @n = employeeid from employees where companyID=1 and idnumber='1-1'
--select @n
if(@n is null)
......
If there is no such employee, in 20002, @n will be null, but in 2005, @n is -1, not null. Am I right?
So, for this piece, I have to do twice on the same where, like
if(exists(select * from employees where companyID=1 and idnumber='1-1'))
select @n=employeeid from employees where companyID=1 and idnumber='1-1'
else
set @n = null
Any better way?

Thanks.

View 1 Replies View Related

Getting Exception While Installing SQL Express 2005 In Windows Vista OS

May 21, 2007

Hi All,

I have developed an windows application using C#. I am using SQL Express as back-end.

I have created an installer class which first installs .NET Framework2.0, SQL Express2005 and then the

application. It is woking fine with WindowsNT and XP oprating systems.

If i try to install this on Windows Vista OS, I am getting expection while installing SQL Express(Creating SQL

Instance).

Can anybody help me in this scenario.



Regards,
Doppalapudi.

View 3 Replies View Related

Strange Problem Sql 2005 Returning Different Size Result Sets From Different Machine..

Nov 5, 2007

Hi,

I have a very strange problem using SQL Server 2005

I have several machines running an application, the problem is that on all machines except one of them the size of the result set that gets returned when I execute the following query is dfferent:

Select * from custoemr where EmployeeID = 3

on three out of the four machine the size of the result set is 1000, where on the other machine the size of the result set is 250, No errors are generated..

Can someome please teel me how to preceed in resolving this issue..

thanks,

View 2 Replies View Related

Strange Exceptions With Views Usings Casts On 2005 (worked Fine On Sql2k)

Apr 3, 2007

I have views that cast the data into data types.



On 2005 when retrieving the views using a where clause i get errors. I have put together an example below that illustrates the error.



CREATE TABLE TestData ( Id VARCHAR(10), [Description] VARCHAR(20), [Type] INT)

CREATE TABLE TestTypeLookup( [Type] INT, [Description] VARCHAR(20))

GO

INSERT INTO TestTypeLookup VALUES (1, 'Type 1')

INSERT INTO TestTypeLookup VALUES (2, 'Type 2')

INSERT INTO TestData VALUES ('AA', 'Description for AA', 1)

INSERT INTO TestData VALUES ('10', 'Description for 10', 2)

INSERT INTO TestData VALUES ('20', 'Description for 20', 2)

GO

CREATE VIEW TestView AS

SELECT TOP 100 PERCENT CAST(Id AS INT) Id, [Description]

FROM TestData

WHERE [Type] = (SELECT TOP 1 [Type] FROM TestTypeLookup WHERE [Description] = 'Type 2')

ORDER BY CAST(Id AS INT)

GO

SELECT * FROM TestView WHERE Id = 10

GO

DROP VIEW TestView

DROP TABLE TestData

DROP TABLE TestTypeLookup

GO

View 11 Replies View Related

SQLBULKCOPy

May 23, 2007

I am using SQLBULKCOPY to copy Excel spreadsheet into SQL Express Database table.  The copying went okay, but the only problem I have is that few records in one of the columns is NULL. 
The column contains numeric and alphnumeric fields in the spreadsheet.  After copying, the numeric fields got copy with no complication, but all the alphanumeric fields all becam NULL.  Can someone help me with this problem?

View 4 Replies View Related

SQLBulkCopy In LAN

Jun 9, 2008

HI,
I have one doubt. Is it possible to transfer data from one SQL Server to other SQL Server over the LAN.( Both the SQL Server database are in different cities)

View 1 Replies View Related

SqlBulkCopy

May 19, 2005

Hello,
I was curious if anyone knew if using SqlBulkCopy in code required any special permissions on the database side.  I wasn't sure if more permissions than writing capabilities were needed.
Thanks.

View 1 Replies View Related

Question On Using SQLBulkCopy

Feb 4, 2007

I need to copy large amounts of data between SQL databases, and between SQL and Access.  I've been reading a lot of good explanations of SQLBulkCopy, but the only good examples I've found are written in C# and I work in VB.  I'm very new to ASP.NET 2.0 (about a month) and came from Classic ASP, not .NET 1.1.  I'm still getting my feet wet and I'm afraid it doesn't take much to confuse me.  Can someone point me to a good article or tutorial that includes a clear example written in VB?
Diane

View 1 Replies View Related

SQLBulkCopy Question

Nov 28, 2007

Hi,
I am trying to use sqlbulkcopy to insert the contents of a data table to a temporary table in the database. The content of data table comes from a csv file. I can add the rows to the data table but it seems they are added as strings and when I try to WriteToServer(datatable) it chokes becuase my table has some int fields. Not sure how to do this.private static TimeSpan DoBulkCopy(string filePath)
{Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
StreamReader sr = new StreamReader(filePath);
prepareTable();string fullFileStr = sr.ReadToEnd();
sr.Close();
sr.Dispose(); string[] lines = fullFileStr.Split('');
DataTable dt=new DataTable() ;string[] sArr =lines[0].Split(',');foreach(string s in sArr)
{dt.Columns.Add(new DataColumn());
}
DataRow row;string finalLine = "";foreach (string line in lines)
{
row = dt.NewRow();finalLine = line.Replace(Convert.ToString('
'), "");row.ItemArray = finalLine.Split(',');
dt.Rows.Add(row);
} SqlConnection cn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["connectionString"].ToString());System.Data.SqlClient.SqlBulkCopy bc = new System.Data.SqlClient.SqlBulkCopy(cn, SqlBulkCopyOptions.TableLock, null);
bc.BatchSize = dt.Rows.Count;
cn.Open();bc.DestinationTableName = "tmpTable";
bc.WriteToServer(dt);   // <---------------   it dies here
cn.Close();
bc.Close(); TimeSpan ts = stopWatch.Elapsed;
stopWatch.Stop();return ts;
}private static void prepareTable()
{SqlConnection cn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["connectionString"].ToString());
string sql = @"if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tmpTable]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[tmpTable]; CREATE TABLE [dbo].[tmpTable] ([Remote] [int],[KFP] [int]) ON [PRIMARY]";SqlCommand cmd = new SqlCommand(sql, cn);
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
cmd.Dispose();
}

View 1 Replies View Related

Question About SqlBulkCopy

Feb 29, 2008

Hello.

I have a problem using SqlBulkCopy for updating tables. In fact, I canīt update any table. I use this function for insert big groups of records, but I would like to know how I can configure SqlBulkCopy for update rows. I would like to see if there is a record (primary key exists) then update it.

Is possible?

Greetings.

Tanen.

View 1 Replies View Related

SqlBulkCopy And Indexes

Apr 25, 2008

Does SqlBulkCopy have any adverse affects on it's target table indexes? I like the performance gain but am worried about creating unnecessary table scans if the indexes/stats are not updated properly after it completes...

View 1 Replies View Related

SqlBulkCopy Error Messages

Sep 6, 2006

I'm using SqlBulkCopy.  Does anyone know how I can output what row (its column names) are throwing a duplicate primary key message when I bulkCopy.WriteToServer(datatable1)?Thanks 

View 1 Replies View Related

SQLBulkCopy Vs. Batch Update

Apr 17, 2007

I have a collection of around 16000 records, and have been trying to find the best way to update the information in the DB. I have done alot of reading about both BulkCopy and Batch Update, but haven't come to any clear solutions as to which performs better. I am not doing any inserting, just getting a dataset from the DB, changing the values, them want to update the Db again. Thanks for any help. Mick 

View 8 Replies View Related

Timeout Using SqlBulkCopy Across Servers

Apr 27, 2007

I'm in the final throws of redesigning a web application, and one of the major improvements is adding in an admin page for the users so they can maintain the data and system structure without the need for us to get involved.
One of the areas I'd held back on was promotion of data from SQL server to SQL server - once .NET 2 framework came in and we moved over to VS2005, I'm now in a position to do this work. 
I have tested it and it works perfectly well for small tables, but as soon as I try it on a reasonably large table (860,000 rows) I get the following error in VS's output window:
"A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code
Additional information: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."
The application data is stored on SQL2005 servers, and I am running the application locally.  I have tried running the copy from table to table on the same server (different databases) and i get the same result, which leads me to believe that it may be memory related.  Running the SQL in SQL Server Management Studio works in just 15 to 20 seconds, but using VS falls over in just under a minute.  My connection string has a timeout of 3600.
Here's my C# code:// Execute reader...
using (IDataReader vReader = vCmd.ExecuteReader())
{
// Create SqlBulkCopy...
SqlBulkCopy vBulkData = new SqlBulkCopy(aTargetConn);
// Set destination table name...
vBulkData.DestinationTableName = aTableName;
// Write data...
vBulkData.WriteToServer(vReader);
}

aSourceConn and aTargetConn are the appropriate SqlConnections, and aTableName is the table to be populated with data (previously backed up and emtied of contents).
Any help/advice suggestions gratefully received - if any more info needed please ask.
Thanks
Martin
 

View 6 Replies View Related

Importing CSV Files With SqlBulkCopy

May 2, 2007

I am trying to import a CSV file into an SQL Server table with the OleDbDataReader and SqlBulkCopy objects, like this:   using (OleDbConnection dconn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\mystuff\;Extended Properties="text;HDR=No;FMT=Delimited""))
{
using (OleDbCommand dcmd = new OleDbCommand("select * from mytable.csv", dconn))
{
try
{
dconn.Open();

using (OleDbDataReader dreader = dcmd.ExecuteReader())
{
try
{

using (SqlConnection dconn2 = new SqlConnection(@"data source=MyDBServer;initial catalog=MyDB;user id=mydbid;password=mydbpwd"))
{
using (SqlBulkCopy bc = new SqlBulkCopy(dconn2))
{
try
{
dconn2.Open();
bc.DestinationTableName = "dbo.mytable";
bc.WriteToServer(dreader);
}
finally
{
dconn2.Close();
}
}
}
}
finally
{
dreader.Close();
}

}
}
finally
{
dconn.Close();
}
}
}
A couple of the columns for the destination table use a bit datatype.  The CSV files uses the strings "1" and "0" to represent these.When I run this code, it throws this exception:Unhandled Exception: System.InvalidOperationException: The given value of type String from the data source cannot be converted to type bit of the specified target column. ---> System.FormatException: Failed to convert parameter value from a String to a Boolean. ---> System.FormatException: String was not recognized asa valid Boolean.   at System.Boolean.Parse(String value)   at System.String.System.IConvertible.ToBoolean(IFormatProvider provider)   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)   at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)   --- End of inner exception stack trace ---   at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)   at System.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaDatametadata)   --- End of inner exception stack trace ---   at System.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaDatametadata)   at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal()   at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount)   at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader)   at MyClass.Main()It appears not to accept "1" and "0" as valid strings to convert to booleans.  The System.Convert.ToBoolean method appears to work the same way. Is there any way to change this behavior?  I discovered if you change the "1" to "true" and "0" to "false" in the  CSV file it will accept them.  

View 3 Replies View Related

SQLBulkCopy Issues With ODBC

Jun 15, 2007

I am trying to use SQLBulkCopy to copy from an excel spreadsheet to a table in a SQL database and it is all working fine, but I have to now change the connection to the SQl database to an ODBC connection and it is now erroring.
This is the error I get - keyword not supported 'dsn'
Is it possible to use SQlBulkCopy when using an odbc connection to the SQL database?

View 2 Replies View Related

I Can't Make SqlBulkCopy Work

Feb 7, 2008

I have a scenario whereby I'd like to insert multiple rows into a table on a SQL server database as efficiently and easily as possible.
After some research, it looked like .NET 3.0's SqlBulkCopy class would do what I want. I've tried to set something up, but it's not working. It's not even throwing an error. The code executes but it simply hasn't done the insert by the end of it!
 My table structure is simple. The name of the table is LPSTUnavailableDate. It has just two columns, one of them an auto-populated ID field:


LPSTUnavailableDateId, INT, PRIMARY KEY, IDENTITY(1,1)

View 1 Replies View Related







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