How Can I Read Data From Spreadsheet (Excell) To SQL Server 2000?
Nov 18, 2005
i have data on a spreadsheet and i need to read it to a table in SQL server ? how can i do that ? some one refere to me a method for that but i need to see what other think is the best option and the most effecienet way let us say!!
I need to import data in several hunderd excell spreadsheets to a sql 2000 table. What function should I use? Do I need to create a table in sql with the same columns as the excell file and then run a query? Iam pretty new to sql, so please be gentle
I've created an excel spreadsheet with a data connection. This data connection uses a query that runs against a read-only database.
The issue I'm having is that the query never seems to finish running against the database, whether I open the Excel spreadsheet to view the data or run the query in SSMS.
I created the connection on the Data ribbon by going to From Other Sources --> From SQL Server and using the Data Connection Wizard.
Is there some kind of setting or property I'm missing that would allow this query to finish running?
HiI need to import data from StarOffice 5.2 spreadsheets to aDatawarehouse built in SQL Server and I wan to know what is the bestway to do it. I think I have the next options:- Create a java app using StarOffice api- Use StarOffice Automation (I'm not shure if its possible in version5.2)Is this right?Exist some ODBC driver for *.sdc files?Exist other option?Which option is the most recommended?Thanks
Firstly, i'm new to integration services and have only done a little with DTS jobs.
I'm trying to create an integration services project which will import data from an two worksheets in an Excel spreadsheet to two different tables in a database. I'm looking at only one table at present to make things a little more understandable.
One stipulation i have is that i need to be able to specify a variable value and insert that as an additional column in the database. I have and Excel source and a SQL destination both of which have been set up with there specific connection managers. I also have a variable which i add in using the derived column task.
When i try to debug this i am getting a few problems. I think these may be to do with the fact that although the worksheet in Excel has 20 rows (1st column shows these numbers) i only want those rows with data in them. If i preview the excel table it shows all the rows including those with null columns. Is there some sort of way that i can only get the rows that have data in the columns after the row number. I.e. can i select rows that do not have a second column value = to NULL.
I hope this makes sense and that someone can help me out with this problem.
All help is greatly appreciated.
Cheers,
Grant
P.S.
Apologies. I have this resolved now. I didn't see the option to use a SQL command as apposed to a table or view when setting up the Excel source.
I am still however getting the following errors which i'd appreciate some help on:
Error: 0xC0202009 at Data Flow Task, Excel Source [1]: An OLE DB error has occurred. Error code: 0x80040E21. Error: 0xC0208265 at Data Flow Task, Excel Source [1]: Failed to retrieve long data for column "Rework Entry Information (BE SPECIFIC)". Error: 0xC020901C at Data Flow Task, Excel Source [1]: There was an error with output column "Rework Entry Information" (170) on output "Excel Source Output" (9). The column status returned was: "DBSTATUS_UNAVAILABLE". Error: 0xC0209029 at Data Flow Task, Excel Source [1]: The "output column "Rework Entry Information" (170)" failed because error code 0xC0209071 occurred, and the error row disposition on "output column "Rework Entry Information" (170)" specifies failure on error. An error occurred on the specified object of the specified component. Error: 0xC0047038 at Data Flow Task, DTS.Pipeline: The PrimeOutput method on component "Excel Source" (1) returned error code 0xC0209029. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "SourceThread0" has exited with error code 0xC0047038. Error: 0xC0047039 at Data Flow Task, DTS.Pipeline: Thread "WorkThread0" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown. Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "WorkThread0" has exited with error code 0xC0047039.
The only way the job success is if I select the option add rows wich is copying all rows even the ones that are already there, I tried to drop amd recreate the table option but i just dosn't run that way, help please..
I am trying to import data from 4 columns in a spreadsheet, the Columns are (Last Name - First Name - ID - Code) and this spreadsheet has around 10k records. I want to add what is in this spreadsheet to the query I have below that uses the EXCEPT operator but I am not sure the best way to go about it.
Using the example I have filtered below for the name "Denise Test", at the end of the day I want everything that is in the spreadsheet to also be excluded from the results.
So before the spreadsheet lets say the 2nd query referencing table C has the following results for Denise Test
Last_Name First_Name ID Code Test Denise 1 5 Test Denise 2 4
After adding the spreadsheet I want it to show this:
Last_Name First_Name ID Code Test Denise 1 5 Test Denise 2 4 Test Denise 3 3
Here is the query as it stands now without the inclusion of the spreadsheet:
SELECT ta.last_name, ta.first_name, tb.ID, tb.code FROM TableA ta INNER JOIN TableB tb
If Conn.State = 1 Then Conn.Close Conn.Open SisSession.SisConeccion strSheetName = "insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=" & CDB.FileName & "; HDR=YES', 'SELECT * FROM [Bitacora]') " & AdoData.Source & ""
Conn.Execute strSheetName
MsgBox "Datos Exportados en " & Chr(13) & CDB.FileName, vbOKOnly + vbInformation Exit Sub Error: If Err.Number = 0 Then Exit Sub ProcessError Err, Me.Name & " - Exportar", , , True End Sub
*******************************************
Whe in configure the app for a network server it gives an error.
OLE/DB provider returned message: Microsoft Jet culd not find the object 'Bitacora'. Make sure the object exists and the route is ok.
This i assume is because the cange of the server from local to remote.
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)
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.
I need to get this data into an SQL table in the following form so I can use it to further manipulate the data and update several other tables. I am thinking that UNPIVOT or CROSS APPLY might be the way to go, but am not sure how to code it.
Hi, I have an issue with an application, and i want to know what sql queries are done by this application. So i need to read the .ldf file, i have do some search on google, but i find nothing thant can be relevant.
hi.. I want to store a RMVB file to SQL SERVER 2000 ,and read from it,iwant to play the RMVB file in web,the size of the RMVB file is more than 300MB less 1G.the SQL Field Image can include it. Now My Quesstion is How can i Store and Read the RMVB file from SQL Server2000? I used SqlInsertCommand.ExecuteNoquery() in my program,but it Too slow,ao make a unknown error. Thank you for your help.
I'm trying to upgrade from SQL Server 2000 to 2005. The problem I am having is that when I try to attach the existing db files I get a message that says "database cannot be upgraded because it is read only or has read only files...."
Thing is... there is no write protection on the files.
Can anyone advise me on how to overcome this problem so that I can attach the db, please?
if it is possible to run a distributed query against 2000 from 2005, what would the OPENDATASOURCE parameters look like? I'd like to be able to pivot without copying my older 2000 db to 2005 or using linked servers..
For reference, here's an example of a distrib query that reads excel...
ie SELECT * INTO XLImport3 FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data Source=C: estxltest.xls;Extended Properties=Excel 8.0')...[Customers$]
I have very little experience with programming and data mining, but I am working on a project where I need to take data from one spreadsheet and place it in another. Since it is hard to describe what I would like to do, I will provide an example:
In this example, the data in Column 1 is always tied to the data in Column 2 (i.e., 100 in Column 1 means 200 in Column 2, etc.) However, the data for Column 2 is only available in SPREADSHEET 2; moreover, the data is not in the same order in both spreadsheets.
My question is how can I create some sort of program where I can transfer the data from SPREADSHEET 2 into SPREADSHEET 1?
I have a column in SQL server which is of type ntext. Selecting the specific column to view it in report builder, an error message appears with the following description:
- Cannot run this report. The grouping expression 'nameofcolumn' returns the datatype binary. The Grouping Expression cannot return binary data.
Report Builder recognises this as if it was an image...
I am new to SQL and can do queries OK on SQLTalk. I need to know if there is a script to retrieve data and then export to an Excel spreadsheet for internal company use. Is there such a beast and is this the right place to look???
I am looking for a way to import data from a CSV or Excel spread sheet and add the data directly into an Extended field instead of a regular field in the table. for example: let's say I have a comma delimited field with the following info:
NDC_M_FORMULARY,CUSTOM_EXTSIG,Custom EXT SIG NDC_M_FORMULARY,DRUG_CODE,Alternate key, user defined NDC_M_FORMULARY,CHARGE_CODE,From the Charge code table
The first column is the table name Second Column is the Column name in the table The third column contains the description that I would like to store in the Value in the Extended Property Name "MS_Description"
BTW,I did find the following T-SQL which returns the Extended description for a specific Extended Property
Here it is:
SELECT [Table Name] = i_s.TABLE_NAME, [Column Name] = i_s.COLUMN_NAME, [Description] = s.value FROM INFORMATION_SCHEMA.COLUMNS i_s LEFT OUTER JOIN
I am using the import wizard in SQL Server 2008 R to import data from an Excel spreadsheet into a table I have created.
The spreadsheet contains 3 columns that SQL recognises as DOUBLE and they contain a 1 or 0. What data type do the corresponding fields in SQL table need to be? I have tried BIT, INT and FLOAT but keep getting an error (can't view details of the error because I get chucked out every time the error pops up). I know the problem is with the DOUBLE data because when I 'ignore' those columns the import works fine.
Im using this query to select ,calculate and format data like Refer here for more understanding:-
Select DateAdd(Hour, DateDiff(Hour, 0, RowDateTime), 0) As RowDateTime, Avg(Meter1) As Meter1, Avg(Meter2) As Meter2, Avg(Meter3) As Meter3 From TableName Group By DateAdd(Hour, DateDiff(Hour, 0, RowDateTime), 0)
I want the output of the query to be written in the excel Sheet.
I get the following error when I use SQL Server 2005 Import/Export wizard to extract more than 255 columns from an excel file;
TITLE: SQL Server Import and Export Wizard ------------------------------ The preview data could not be retrieved. ------------------------------ ADDITIONAL INFORMATION: Too many fields defined. (Microsoft JET Database Engine) ------------------------------ BUTTONS: OK ------------------------------
I am new to SSIS. I am interested in using SSIS to import an excel spreadsheet into a SQL server database. My biggest concern is how to handle/manage errors that might occur when the import process occurs. Can anyone give me any guidance on this? I could write some C# code to do the import and to create a custom .txt file listing errors that occur on import. Using C# code to do the import seems like I would just be reinvinting the wheel so to speak.
Every month a client sends a spreadsheet with data which we use to update matching rows in a table in the database. I want to automate this using a DTS package but am having quite a bit of trouble accomplishing what I think should be trivial task. I've been attempting to use a Transform Data Task with a modification lookup but I just keep inserting the rows from the source excel spreadsheet in to the existing destination table without ever modifying the existing data.
Any guidance would be greatly appreciated as to a best practice approach.
Here is my task I am storing pdf's in sql server. I would like to retrieve the binary data from sql server and write the pdf content into an existing aspx page to the appropriate pageview section. What is the best way to handle this. The code works below but it loads a new browser with the content. I need it to appear in it's tabbed section in the original aspx file. Any assistance you can give me would be greatly appreciated. Thanks Jerry oSQLConn.Open()Dim myreader As SqlDataReader myreader = myCommand.ExecuteReader Response.Expires = 0 Response.Buffer = True Response.Clear() Do While (myreader.Read()) Response.ContentType = ("application/pdf")Response.BinaryWrite(myreader.Item("img_content")) Loop
hello. i have a _CommandPtr that has the type CommandTypeEnum::adCmdTex, and the CommandText a query("Select * from Table_1") and this select returns one row that has a binary data in it.
Code Block
_CommandPtr pCommand; //Create the C++ ADO Command Object
pCommand.CreateInstance(__uuidof(Command));
pCommand->ActiveConnection = this->pConnection;
//Make the ADO C++ command object to accept stored procedure
Code Block long GetArraySize(const VARIANT& var, long * nElems) {
if ( !(var.vt & VT_ARRAY) ) return -1;
long size = 0; long dims = SafeArrayGetDim(var.parray); long elemSize = SafeArrayGetElemsize(var.parray); long elems = 1; for ( long i=1; i <= dims; i++ ) {
long lbound, ubound; SafeArrayGetLBound(var.parray, i, &lbound); SafeArrayGetUBound(var.parray, i, &ubound); elems *= (ubound - lbound + 1); } if ( nElems ) *nElems = elems; size = elems*elemSize; return size; }
I enter in VARIANT var = pRecordset..... and if gives me a value... but when I put it in Memory explorer in VS, i only see this data " fe ee fe ee fe ee fe ee fe ee fe ee fe ee ...fe ee" and of course it brakes at SafeArrayGetLBound(var.parray, i, &lbound);
Can someone tell me where I am doing a very bad thing?
P.S. I was able to read the binary data from the server using C#.NET 2.0.
I have an ORACLE server say "A". I have a SQL Server named "B". In SQL Server I have a table named "test" who contains only one field named "aa" which is "BIT" type field. I want to query this table of "B" from "A" interface through Oracle's DB Link and ODBC dsn for Sql Server. But it gives error. If I changed the data type of field "aa" to "int", then it reads easily. Please suggest.
I'm trying to use Excel in SSIS to import the data from spreadsheet to a staging table. The package runs well from the web server using SSMS. But when I deploy and try to execute the package, I'm getting the below error. I've a question, whether I've to install the AccessDatabaseEngine driver in SQL database server or the web server where I'm executing the SSIS?
Error: The requested OLE DB provider Microsoft.Jet.OLEDB.4.0 is not registered. If the 64-bit driver is not installed, run the package in 32-bit mode.
hello All, Am not sure if this is the right forum to post this. But here goes
I have a phone book, which users could enter numbers via a web interface and a SP.
However i was wondering how to generate a bulk insert script, that would
Import from an uploaded excell workbook to MS SQL How could this be done
NOTE: Am doing an upload via an ASP page, then hoping that either the ASP page, via a SP or an SQL command Statement do a bulk copy for the user who uploaded it to my SQL table
Hi, I was wondering which is the best way to read data from a txt file and insert each row into sql. OLE DB Command could be? It will be necesary to work with variables? My txt file will have a defined width (if it is necessary to know). I will have many rows with many columns. I have to map eah column from the txt file to it's corresponding column in sql server and insert data into it for each row. Thanks for your help!