DTS Excel Import, Transform - How Do I Use OR Clause In SQL Query
Jul 20, 2005
Howdy. I'm trying to build a query that will take an Excel file and
pull a few rows of data from a particular sheet. I'm having a problem
with my WHERE clause - I can can tell it to import WHERE a field
matches a value, or WHERE the field matches another value, but not
both.
I've tried bunches of different variations, but can't get it to work.
Is there any way to do this?
Works:
select F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12
from `RAF082604$`
where ((F1 = 'Body'))
Works:
select F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12
from `RAF082604$`
where F1 = 'Cash'
Doesn't:
select F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12
from `RAF082604$`
where F1 = 'Body' OR F1 = 'Cash'
Doesn't:
select F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12
from `RAF082604$`
where (F1 = 'Body' OR F1 = 'Cash')
Doesn't:
select F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12
from `RAF082604$`
where ((F1 = 'Body') OR (F1 = 'Cash'))
View 1 Replies
ADVERTISEMENT
Apr 26, 2007
Hi,
I have a table with a BLOB column, and I need to populate this table including the BLOB column (image type in the database).
What I have done is:
1. use a flat file transform to read a .csv file which specifies the names of the files that store the binary contents for the BLOB column for each row.
2. use an Import Column Transform to read the binary files.
3. use an OLE DB Dest transform to dump the data into my destination table.
I got the error saying:
Error: 0xC02090BB at XXXX, Import Column [1]: Opening the file ".diagram1.bin" for reading failed. The file was not found.
I guess this is because my file "diagram1.bin" is not in the current path? (The current path can be found by "System.IO.Directory.GetCurrentDirectory() call, in my case it is "c:program filesmicrosoft visual studio 0common7IDE".)
My question is: how to determine the directory path information of the package I am running?
Thanks!
Wenbiao
View 3 Replies
View Related
Apr 21, 2006
Does SQL 2005 Express have standard functionality on board to export data as an excel sheet? or as XML in a specified format?
View 4 Replies
View Related
Jul 29, 2015
I am trying to import an xlsx spreadsheet into a sql 2008 r2 database using the SSMS Import Wizard. When pointed to the spreadsheet ("choose a data source") the Import Wizard returns this error:
"The operation could not be completed" The Microsoft ACE.OLEDB.12.0 provider is not registered on the local machine (System.Data)
How can I address that issue? (e.g. Where is this provider and how do I install it?)
View 2 Replies
View Related
Jun 14, 2006
l've the following situation,
l've some excel files controlled by Vendor which changing frequently. The only thing does not change is the header name of each column.
So my question is, is there any way to create a new table based on the excel file selected including the column name in SSIS? So that l can use the data reader as source to select those columns l am interested on and start the integration.
Thanks.
Regards,
Yong Boon, Lim
p/s : The excel header is at the row 7.
View 3 Replies
View Related
Jul 6, 2015
While importing data from Excel source , some column is getting null value even though excel column has value.To Resolve the issue we tried with
HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftOffice14.0Access Connectivity EngineEnginesExcel
1.Change the Value of the Row TypeGuessRows from 8 (Default value) to 0 and ImportMixedType = text
• xls
HKEY_LOCAL_MACHINESOFTWAREMicrosoftJet4.0EnginesExcel
1.Change the Value of the Row TypeGuessRows from 8 (Default value) to 0 and ImportMixedType = text
the connection string of the excel
UPPER(REVERSE(SUBSTRING( REVERSE(@[User::VarInputExcelFile]), 1, 5) ) ) == ".XLSX" ? "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + @[User::VarInputExcelFile] + ";Extended Properties="Excel 12.0;HDR=Yes;IMEX=1";":"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" + @[User::VarInputExcelFile] + ";Extended Properties="EXCEL 8.0;HDR=Yes;IMEX=1";"
by doing the above setting also , the column is coming as null from excel source even though there is data in excel.
View 2 Replies
View Related
Aug 31, 2006
I'm new to SQL Server 2005. I used the TRANSFORM query in Access to display the data I had stored in columns into rows. I want to do something similar in SQL Server 2005 but it doesnt let me. I have used the same query here, but it gives an error.
This is the query I was running in Access and it was working:
TRANSFORM Max(Schools.Expense) AS MaxOfExpense
SELECT Schools.[FiscalYear], Max(Schools.[FIPS]) AS [Total Of FIPS]
FROM Schools
GROUP BY Schools.[FiscalYear], Schools.[FIPS]
PIVOT Schools.[DataID];
If there some other syntax for SQL Server or it doesnt support this command or what???
View 1 Replies
View Related
Jan 24, 2008
Hi
I want to import excel in SSIS via sql command and change the data types. can anyone guide me on this or give me some sample command on how to change datatypes explicitly.
View 1 Replies
View Related
Jul 23, 2005
Okay all I have a problem. I have two list of adresses and phonenumbers. I do not have control over the contents of the lists The onlyunique field between the two is the phone number. I need to be able toinner join the two lists on phone number.This would normally be straigt forward but the problem is that they areformated different and one of them does't even have a control on theformating.*Phone numbers are US phone numbers only.The one list (table) that does have a control uses this formatAAA3334444where AAA is the area code333 is the 3 digit prefix4444 is the four digit suffixthe second list (table) does not have any standardized formating andcan be filled with extraneous spaces, parentheses and dashes not tomention the leading 1 in some instances.I thought that I could do some kind of regular expression to do acomparison but I havn't as yet found a good resource to tell me how todo it or if it is even possible. Or maybe break up the one I know hasa standardized format into something like this:'%AAA%333%4444%' and doing my comparison that way. however It is veryimportant that only those list items in both list that are truly thesame place be listed.suggestions and solutions are apreciated
View 3 Replies
View Related
Mar 3, 2004
I'm getting this error in a simple DTS package.
No query specification returned by transform status.
Any ideas what's causing this ?
DTS is simply running a query (which returns data via preview)
and insert results into a table.
Thanks
Mark
View 1 Replies
View Related
Jun 16, 2015
I have three tables, Accounts, AccountCustomer and Customers, and the data-relationshiop between are defined according to the image below:
I created also a query (the sql-query below), displaying the customers for every account that is on the table "Accounts", and I got the results, as we can see in the image below:
SELECT A.AccountID,
c.CustomerNo,
c.Surname,
c.Name,
c.TaxNum
FROM Accounts A
left join AccountCustomer ac on ac.AccountID = A.AccountID
left join Customers c on c.CustomerNo = ac.CustomerNo
order by A.AccountID;
As we understand, an "AccountID" have multiple customers, so I want to transform tha multiple results to one row, grouping by AccountID (one account belongs to one or many Customers), like the image below:
I tried to use row_number()-expression to get this, but I didn't make it. So my question is, how can I alter my sql-query to get the final result like image above?
View 6 Replies
View Related
Jul 21, 2015
I'm importing a multi tab spreadsheet using Import wizard, which I understand to use the same internals as SSIS. The total number of columns in the spread sheet will be over 500. The import wizard defaults everything to varchar 255. I understand there is an XML file I can manipulate to change this and they are located
C:Program FilesMicrosoft SQL Server100DTSMappingFiles
Assuming one of these will control Excel defaults, which one is it? None of the names lend themselves to the Excel as a source. SqlClientToMSSql10?
View 6 Replies
View Related
Jul 29, 2013
Still having a problem with my SQL WHERE clause…
I have three variables on an Excel form that connects to a Teradata database. The first variable is a date format (DateworkedF and DateworkedT) the other two are text fields. (StatusX and ErrorTypeX)
I want to be able to search on any or all of these fields. (If the field is blank return all values)
Query = "SEL SRN_ACCT_NUM, QUEUE_NAME, ERROR_TYPE, SUB_ERROR_TYPE, DATE_WORKED, MONTH_WORKED, DATE_APPLICATION_RECEIVED, ASSOC_WORKED, ACCT_ID, STATUS, COMMENTS, REVIEWED_IND, REVIEWED_AGENT, LOAD_DT " & _
"FROM UD402.JD_MCP_MASTER WHERE " & _
"(DATE_WORKED >= #" & DateworkedF & "# Or #" & DateworkedF & "# IS NULL)" & _
"AND (DATE_WORKED <= #" & DateworkedT & "# Or #" & DateworkedT & "# IS NULL)" & _
"AND (STATUS = '" & StatusX & "' OR '" & StatusX & "' IS NULL)" & _
"AND (ERROR_TYPE = '" & ErrorTypeX & "' or '" & ErrorTypeX & "' IS NULL);"
View 5 Replies
View Related
Apr 11, 2003
Hi,
I am importing data from Excel to SQL Server. My Excel files are .html file format. Using ActiveX Script I am saving that file to xls file format as follows
Set myXL = CreateObject("Excel.Application")
Set myXLWorkBook = myXL.Workbooks.Open(filename)
Set myXLWorkSheet = myXL.ActiveSheet
myXLWorkBook.SaveAs filename, 43 '43-xlExcel9795
Set oPkg = DTSGlobalVariables.Parent
Set oConn = oPkg.Connections("Excel")
This script works fine but it prompts me that the file already exists do you want to replace it. How can I avoid this prompt
Secondly this file contains data like that
Col1 Col9 Col10
Row-1 Report Name
Row-2 From Date
Row-3 To Date
Location Count Amount
9999 1 100.00
9876 10 20.40
Where Row are the excel rows
The TransformData Task thinks that the Col 1 is of nvarchar(255) but after the tranfer all values in Col1 is NULL. How can I convert a nvarchar to Char or varchar
Here is ActiveX Script for Transformation
Function Main()
Dim Result
DTSDestination("Amount") = DTSSource("F10")
DTSDestination("Count = DTSSource("F9")
DTSDestination("StoreNumber") = DTSSource("ReportName")
Result = DTSTransformStat_OK
Main = Result
End Function
:)
View 6 Replies
View Related
Feb 10, 2006
I'm needing to import a .csv file into a SQL database. This needs to be done through automation so I need the DOS commands, if any. Or if someone knows a better way, feel free to enlighten me.
I've tried looking in books online for SQL server but haven't had much luck.
View 5 Replies
View Related
Oct 29, 2004
I've been asked to create an automated DTS import which is to take place each and every evening. The import routine is to import data into an SQL table from an Excel spreadsheet.
The spreadsheet is not massively complicated though is does contain formulas and calculations.
When using the DTS Wizard:
"Choose Data Sourse"
Data Source = Microsoft Excel 97-2000
I then browse to the file name.
"Choose Destination"
I select the Server name and Database to import into.
"Specify Table Copy or Query"
I select 'Use a query to specify the data transfer' then click Next.
I then click on the query builder and here's where I get stuck. The Source tables panel contains many rows and when expanded they all contain the same thing (field headings in the Excel spreadsheet).
I'm totally stuck here - can anyone help? :confused:
View 1 Replies
View Related
May 18, 2007
Hi all,
Can anyone suggest a method of importing an Excel spreadsheet into SQL as a table?
TIA,
SamuelT
View 2 Replies
View Related
Dec 7, 2007
Hii
I want to import data from excel 2003 to sql.(sql server 2005). i am using windows xp.
when i am using the code i get the error.
the code is :
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 11;Database=D:BAESystemsTest_Log.xls;HDR=YES','Select * From [Sheet1$]')
The error is :
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Could not find installable ISAM.".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".
please get me out of this trouble.
View 10 Replies
View Related
Nov 18, 2007
Hi,
I have to import Excel file to SQL Server 2005 using SSIS. I am having alot of problems and was wondering if it's no trouble if you could please instruct me how to proceed.
My scenario:
I have an excel file that contains a heading and then subheading such as
HEADING
Acc_g Acc_n
12 n_a2
13 n_b3
My database has a table called accounts with fields acc_g and acc_n.
I need to enter the values from the excel into the table. I tried doing it but SSIS also tries to insert the rows following the last line in excel and returns nulls and the table does't allow null values.
How can i resolve it?
Thanks
View 3 Replies
View Related
Jun 21, 2006
I am trying to import data from an excel spreadsheet. The file comes from a client and sometimes it may not have any data, that is, it will be blank. It seems that the Excel Source in SSIS does not like empty files, is there any way around this? I suppose I can check to see if it is empty and abort the import process but I am not sure how to do this. Any other ideas on how to get around this??
View 3 Replies
View Related
Feb 27, 2008
i want a simple way (straight forward) to import data from excel to sql, not only this, but the excel file is not located on the SQL server itself.
my situation is the a person upload a file via asp.net and the file should be imported to excel(i want to use sql to transform and not parse in .net, then insert into database).
This can be done?
Thanks in advance
View 5 Replies
View Related
Jun 15, 2007
Hi, I'm building a web application in VB.NET 1.1 where users will upload Excel files at this webpage and the web application will transfer the data from the uploaded Excel file into MS SQL 2000. There are around 600-700 records and about 56 columns in the Excel file which is to be uploaded daily. There will be a few different files which I need to implement for as well.
I've sourced for and tried alot of methods. But either they can't satisfy my requirements or they just can't simply work.
- Most simple and direct way I've tried is creating a oledb connection to the Excel file in the following codes...
Function TestUploadData1(ByVal vFile As String) As String Dim Oleda As System.Data.OleDb.OleDbDataAdapter Dim Olecn As System.Data.OleDb.OleDbConnection Dim dt1 As DataTable
Olecn = New System.Data.OleDb.OleDbConnection( _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & vFile & ";" & _ "Extended Properties=Excel 8.0;HDR=Yes") Olecn.Open()
Dim ExcelCommand As New System.Data.OleDb.OleDbCommand("SELECT INTO [ODBC;Driver={SQL Server};Server=(local);Database=dbSSC;Trusted_Conn ection=yes].[tblOutstanding] FROM [Report$];", Olecn) ExcelCommand.ExecuteNonQuery()
Olecn.Close() End Function
But from the above codes I kept getting the error "Could not find installable ISAM." at the line Olecn.Open(). I've tried to set the registry to C:WindowsSystem32msexcl40.dll but to no avail...
- I've tried another method using the OpenRowSet in the following codes Function TestUploadData2(ByVal vFile As String) As String Dim cn As SqlConnection Dim cm As SqlCommand Dim strSQL As String cn = New SqlConnection("server=localhost; user ID=accessSSC; password=accessSSC541; database=dbSSC")
cn.Open()
strSQL = "INSERT INTO tblOutstanding SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=" & vFile & ";HDR=Yes','SELECT * FROM [Report$]')" cm = New SqlCommand(strSQL, cn) cm.ExecuteNonQuery()
cn.Close() End Function
For the above codes, I kept getting the error "Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied. You must access this provider through a linked server." at the line cm.ExecuteNonQuery() and I've tried to disable the Ad Hoc settings in the registry and tried to create a link server but to no avail as well...
- I've tried DTS but I'd need to DTS package to run whenever the users upload a file. Is there an easy way that I can run the designated DTS package to run through my .Net web application?
Any help would be deeply appreciated. Thanks & Regards, Keith Chang
View 8 Replies
View Related
Feb 9, 2004
Hi:
I imported data from Excel to a table on SQL Server throught Data Transformation Services.
All data with a under score(like 1_5, 7_5) were replaced by Nulls. Is there any comment
about that?
Thanks a lot!
Regards,
Kevin Jin
View 6 Replies
View Related
Apr 24, 2001
I would like to know:
How can I import tables from the Enterprise Manager to Excel (copy and paste)?
Is it possible?
thanks
View 1 Replies
View Related
Feb 28, 2003
Hi:
I am writing a custom application which will allow users to upload data in a Excel to SQLServer.
The problem I have is that Excel can come with a number of worksheets. I would ideally like to read from the default work sheet - is there a way I can specify that my code should only pick up the default worksheet?
Thanks,
Bianca
View 3 Replies
View Related
Feb 10, 2005
Hi guys,
I need to import data from excel to MS SQL table, but I already have data in MS SQL table, I just want to update one column.
How can I do that?
View 1 Replies
View Related
Apr 23, 2007
I have data in excel files I want to import it to existing SQL Server database. I can use SQL Server built in import tool but before Importing, the data needs to be validated. What is the best way to do this?
Thanks
View 1 Replies
View Related
Feb 17, 2007
Hello All
First time setting up A SSIS
Trying to import a excel that creates a new table called lockbox.
Does not import any records from Columns-Contract Id, Owner ID,
that have a null value.
Then in the Site Id -that is a number value- change to a text value
and update it to it text value.
for example: Site Id Column
2 = Ell
3 = CSI
12 = Ell2
Can someone get me started in the right direction?
Thanks for your time and help
JK
View 1 Replies
View Related
Jun 9, 2007
Hi,
On SQL 2005 I am trying automatically through the import 'wizard' import data from excel into an existing table that I have created. I can't find a way to do this without creating a new table. Any takes?
View 5 Replies
View Related
Jun 18, 2007
How to create SSIS Package to import data from excel
View 2 Replies
View Related
Aug 16, 2007
Hi!
I'm trying to import data from an excel file into a sql table.I'm using MS SQL.For import,I use openrowset.The SQL command looks like this(in my asp page):
SQLstr = "SELECT * INTO dbo.shopping_TSR FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database="+Server.MapPath("\fileuploader\upload\tmb2.xls")+"', 'SELECT * FROM [Sheet1$]')"
I'm getting the following error:
[Microsoft][ODBC SQL Server Driver][SQL Server]OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize::Initialize returned 0x80004005: The provider did not give any information about the error.]
What could be the cause of this error?
The .xls file and the sql table are on differen t servers.
Can anyone help?
Thanks in advance.
View 1 Replies
View Related
Jan 27, 2008
Hello all,
I wanted to export data from sqlserver and import into excel. My issue here is, when i import into excel, i wanted to update the records in excel if the same record exists in excel. Any one can help me on this...
Thanks
View 3 Replies
View Related
Feb 7, 2008
Hi,
I have a large excel file that contains some contact information and includes the following columns:
Company Name, Company Fax, Company Address, Contact Person
In the db I have 3 tables that I need to insert into:
Company table
id ([uniqueidentifier] NOT NULL DEFAULT (newid())
Company Name nvarchar (200)
Company Fax nvarchar (200)
Company Address nvarchar (200)
Contact table
id ([uniqueidentifier] NOT NULL DEFAULT (newid())
Contact Name nvarchar (200)
Contact_Company table
id ([uniqueidentifier] NOT NULL DEFAULT (newid())
contact_id [uniqueidentifier] NOT NULL,
company_id [uniqueidentifier] NOT NULL,
In addition, the excel file will contain the company name more than once (for every contact person in company new row with company name).
I need to insert into table Company the company only once.
I then need to insert the Contact details into the table Contact
Finally, i need to insert into Contact_Company table both the company_id and contact_id
Problems:
-How do i insert into Company table the company only once from excel?
-How do i insert into Contact_Company the correct contact_id and company_id so that the right contact person will be assigned to the company?
Thanks for the help
Whisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much.
View 3 Replies
View Related