I need to get some data from an enormous, creaky old SQL 6.5 database.
I know nothing about either the data schema (though I believe some sort
of documentation exists), nor 6.5 for that matter, having come to SQL
Server at 7.0.
My clients need the data in comma delimited format.
Please, can anyone suggest any possibilities? One thing that occurred
to me might be to create an Access application, use an ODBC link to the
SQL DB, and then leverage Access' not inconsiderable functionality to
get the data out.
Does anyone foresee any problems with this, or any better ways?
Forever in your debt.
Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk
I have to extract, dayly a list of contacts on a exchange server in a table on our EDW on sql server 2005. Is it possible to get the information directly from a dataflow or i will have to developpe a script task ?
I want to export data from SQL Server2005 to an Excel spreadsheet thru "Data Flow Task". I am using OLE DB for SQL Server for the source connection and a Connection To Excel as my destination source. The Excel spreadsheet (2003) exists and has the first row with column names. I don't have any warnings before trying to execute.
While executing the tasks, I got the error Error: 0xC0202025 at Data Flow Task, Excel Destination [427]: Cannot create an OLE DB accessor. Verify that the column metadata is valid. Error: 0xC004701A at Data Flow Task, DTS.Pipeline: component "Excel Destination" (427) failed the pre-execute phase and returned error code 0xC0202025.
After analysing I found in the DataFlow --> Excel destination --> Advanced Editor for Excel Destination, the default data type for txtRemarks shows as "Unicode string [DT_WSTR]". But this is supposed to be "Unicode text stream [DT_NTEXT]". Even if I change the data type in the design time, It doesn't accept.
I have a package which establishes connection with DB2 server.I dont have any db2 application where i can format query for db2.This is my query in access/sql. can someone help me converting it into a db2 query.i tryed to google and use the functions but i failed and even the error that ssis gives don't help asthey are same for any type of error. Thanks in ADV
SELECT table1.YYYY & table1.MM as MO_YR, table2.CNTRYCD AS CNTRY_CD, Sum(table1.AMT) AS [VALUE] FROM table1 INNER JOIN table2 ON (table1.MM = table2.MM) AND (table1.YYYY = table2.YYYY) WHERE (table1.YYYY BETWEEN YEAR(DATE()) AND YEAR(DATEADD("m",-3,DATE()))) AND (table1.MM BETWEEN MONTH(DATE()) AND MONTH(DATEADD("m",-3,DATE()))) GROUP BY table2.CNTRYCD, table1.YYYY, table1.MM
Hi, I'm hoping someone has an idea or two on this topic. Basically I have three tables of data say tContact, tQuestion, tAnswer
tContact ----------- ContactID Email Name
tQuestion ------------ QuestionID Question
tAnswer ------------ QuestionID ContactID Answer
I need to extract the data for the client and they would like to see the data with one line per contact, but showing every answer to every question... they would like the data formatted like this:
Obviously to get the data I cansimply do an outerjoin to get all contact data then all questions, and answers that exist... but that will obviously return tabular data with one row per each answer... Does anyone have any ideas on how to do this using just SQL? I can pull the data and write a function that spits it out to text using the Stringbuilder class and some logic, but I'm thinking this must be possible in SQL natively... any help would be more than appreciated. Thanks in advance.
Hello,Please see the original data below. I would like to extract the accountwith the earliest opening date only, and leave all the accounts openedafter that out. Could anybody help me with the query? Thanks a lot!Original Dataperson_idaccountopen_date1000111111115/15/20031000122222226/20/20041000133333332/16/2005Ideal Outputperson_idaccountopen_date1000111111115/15/2003
Hi,Anybody have an idea of copying data from tables of a database to anotherdatabase. It should be a choice to select all tables, single table orseveral tables.For them knowing Oracle it is possible to do it with 'exp', where you canchoose to script the database with or without data. So I am trying to getalike to MSSQL. The job is to unload data from a database with onestructure to another database with another structure.Thanks in advanceBest regardsTom Frank
I have a table containing 3 columns Department Name, RiskScenario and Cost. I am trying to create a data extract that contains the top 3 Risk Scenarios (sorted by Cost) per Department.
I tried using this sql statement in MSQuery but it doesn't work. Any ideas where I'm going wrong or if there is a simpler way to do this?
Select * from ( Select DepartmentName, `Risk Scenario`, Cost, row_number() OVER (PARTITION BY DepartmentName order by Cost) rn FROM 'Departmental Risks`) where rn <=3
Hi everyone. I need help extracting information from a concatenated field delimited by a '/' character. I know that the logic is to basically find the position of the '/' character and use the substring function to extract the data but I am unfamiliar with how to do this in SQL Server 2000. Please see examples below. Thanks in advance.
FIELD ---------- 1234/4567 2345/6754 1234
I need to extract the data before and after the '/' character. There are records however with on the leftmost part of the data such as row number 3.
FIELD 1 FIELD 2 ------------------ 1234 4567 2345 6754 1234
I need to extract records for the last day of previous months (Up till January of the same year) from a table SALES, according to a date parameter ASOFDATE that the user enters.
For Example
If user keys in ASOFDATE as 10-May-2014, I would have
I'd need to have a function that allows me to extract 'fields' fromwithin the stringI.E. (kinda pseudo code)declare @foo as varchar(100)set @foo = "Robert*Camarda*123 Main Street"select EXTRACT(@foo, '*', 2) ; -- would return 'Camarda'select EXTRACT(@foo, '*', 3) ;-- returns '123 Main Street'select EXTRACT(@foo, '*', 0) ;-- would return entire stringselect EXTRACT(@foo,'*' , 9) ;-- would return nullExtract( string, text delimiter, occurance)Anyone have something like this as a user defined function in SQL?TIARob
Hi, I have just started learning SSIS. Could someone please tell me if where can I find step by step instructions on how to simply extract data from two excel files and populate the relevant table. What I simply want to do is:
Excel File 1 (With Columns FirstName, DateJoined) + Excel File 2 (with column Summary) | | ->Add these three columns to a new table called CustSummary
Any thoughts and suggestions will be really appreciated.
In Integration Services I am trying to extract pieces of information from Excel. I would like to select just information from one cell but when I do that I get an error. What I'm typing in is:
SELECT *, Now() FROM [Sheet1$A1]
Here is the error: ------------------------------ Error at Data Flow Task [Excel Source [170]]: An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft JET Database Engine" Hresult: 0x80004005 Description: "The Microsoft Jet database engine could not find the object 'Sheet1$A1'. Make sure the object exists and that you spell its name and the path name correctly.".
Error at Data Flow Task [Excel Source [170]]: Unable to retrieve column information from the data source. Make sure your target table in the database is available. ------------------------------ ADDITIONAL INFORMATION: Exception from HRESULT: 0xC020204A (Microsoft.SqlServer.DTSPipelineWrap) ------------------------------
The only way that I can get the contents of one cell is if I type in a range and indicate in the Connection Manager that the first row has column names. Given that, to get the contents of A2 I am having to type in:
SELECT * , Now() FROM [Sheet1$A1:A2]
This gets me what I want but by using this method I am never able to get information in Row 1. That could pose a problem in the future and I'm sure that there is a better way to do it.
So my question is, how can I get something from a single cell without having to name a range?
Two other questions I have are: 1. Is there a way to get information in one statement from cells that aren't adjacent to one another. For instance, if I wanted the contents of just A2 and C4?; 2. Is there a way that you could select a named range from Excel? That would be good because then I could have Excel control the range and then just call that.
I know this is a lot but I have an impending project where I'll need to do much of this and I have only ever imported the contents of an entire sheet and not specific cells from a worksheet.
First of all I am a novice here. I am working on a table with a column of URL. I want to seperate the data in the URL delimited by '/'. Eg: http://www.simpletech.com/upgrades/aopen/s661fxm/s661fxmintelp4/
Here I want aopen as manufacturer, s661fxm as model_number and intelp4 as submodel_number. I solved this problem in Oracle using substring and instring. But I have no ides how to achieve this in SQL server. Please..advice me. Thanks in advance.
I have searched everywhere for an answer and seems I am either blind or there is no simple solution. Basically I have a need to report on data stored in an Exchange 2003 data store. There is mention of a OLE DB for Exchange 2000 but nothing for Exchange 2003. For example, A company report on time spent on various categories in a staff's calendar, etc. I would like to use SQl 2005 SSIS to extract and reporting services to report. Why is this so difficult? I come from a Lotus Notes / Domino background and there are numerous articles and ways to do this? Please can some MS guru please give me some direction on where to look?
I have a excel sheet that has data that needs to be UpSert'ed into 2 different tables. In addition, I need to use a value in the spreadsheet to determine the PK from a reference data table, for one of the UpSert oprations.
That is all working now.
The thing I'm struggling with is something I am sure is quite simple - but I'm not seeing a solution from attempts, googling or BOL.
2 of the columns I receive have either nothing, or X in them. The columns they go into are defined as BIT, NOT NULL.
So, in SQL it would be something relatively simple like:
CASE
When IsAvailable = 'X' then 1
When IsAvailable is null then 1
ELSE 0
end
But I don't know how to do this to data that was in a spreadsheet, and now is a resultset being handed from a task to another task.
to outline my current solution:
---- table 1 = this all works -------------
Excel Source --> MultiCast (For Table 1)-->Data conversion for table1-->:Sort for Table1--> Merge Join for table 1 (left Outer join) as 'left' leg
Table1 Source --> Sort Table1 --> Merge Join for table 1 (left Outer join) as 'right' leg
Merge Join for table 1 --> Conditional Lplit for table1
Conditional Split for table1 (table1 source PK is null) -->Insert Into Table1 Destination
Conditional Split for table1 (table1 source PK is not null) -->Update Table1 OLE DB Command
---- table 2 = this needs to be able to convert X/NULL to BIT -------------
MultiCast (For Table 2)-->Copy Column for Table2 -->Data Conversion for Table 2-->table3 lookup to get FK-->Sort for Table2 merge-->Merge Join for table 2 (left outer join) as 'left' leg
Table2 Source --> Sort Table2 --> Merge Join for table 2 (left outer join) as 'right' leg
Merge Join for table 2 --> Conditional split for table 2
Conditional split for table 2(table2 source PK in null) -->insert into table 2
Conditional split for table 2(table2 source PK in not null) -->update table 2 ole db command
-----------------------------------------
Now, if I correct the spreadsheet to have 0's and 1's in the two column, then the process above works. But I cannot (yet) force business to do that.
If tried to use SQL Command for the excel source, but there is limited functionality on the command - I cannot do SQL coalese, isnull or case statements, which would allow me to resolve that data at source.
I've tried to use derived columns to alter the columns. I think that the REPLACE (IsAvailable, VariableContainingX,VariableContaining1) might work to change X's to 1, but that doesn't resolve the NULL issue.
I've tried to use a script component to handle the conversion - which REALLY feels like a bad way to do this - the .Net script is wrote was:
-------------.net script code-------------
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Imports Microsoft.SqlServer.Dts
Public Class ScriptMain
Inherits UserComponent
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
If Not (Row.EndOfRowset) Then
If (Row.IsDotComVanEnabled_IsNull) Or (Row.IsDotComVanEnabled.Equals("X")) Then
Row.IsDotComVanEnabled = "1"
End If
If (Row.IsStoreCollectionEnabled_IsNull) Or (Row.IsStoreCollectionEnabled.Contains("X")) Then
Dear all, I have a table containing some information that needed to generate a XML file periodically. Do anyone has idea how to achieve it in SSIS? Thanks a lot!
Hi all, I've created a database named HyperCodexDB.mdf and I'm trying to extract some information from, I've no error, but the code after Open() method is even not executed: Here is the Web.Config
and in the .cs file :
Hashtable names = new Hashtable(); int i = 0; string conn_str = ConfigurationManager.ConnectionStrings["hcConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(conn_str); SqlCommand cmd;
cmd = new SqlCommand("SELECT Nom FROM TableRecueil", con); SqlDataReader rdr = null;
try { Label1.Text = "Hello"; ////////????Here changes the value of the label con.Open(); Label1.Text = "Bye"; ////////????But here the value of Label1.Text remains "Hello"
How to extract data from 3 excel sheets (same excel doc having multiple sheets with different # of columns & rows) using SSIS 2008. The end result will be 6 tables loaded in the database.
There is a simple SQL table ("mytable"). Say, it has 100 rows and 5 columns. One of the columns (say "time") contains timestamps across the whole day and the data in this column has the following format: hh:mm:ssAM/PM. So, the table looks like this:
time var1 var2 var3 var4
12:00:01PM value ... 12:00:05PM value 12:00:08PM value 12:00:20PM value 12:10:12PM value ...100 rows
How to create simple SQL request for extracting data between any 2 timestamps? For example, I need sub-table of the initial table containing all data values between 12:00:05PM and 12:00:20PM:
time var1 var2 var3 var4
12:00:05PM value 12:00:08PM value 12:00:20PM value
I'm trying to extract data from our database for the number of phone calls our reps are doing.
In counting the calls I only want to include up to 3 calls to the same customer (field name is CompanyID) per day - anything more than this is ignored.
The query at the moment is something like:
SELECT COUNT(CallID) AS CallCount FROM Sales_Calls WHERE CallDate >= '2014-09-01' AND CallDate <= '2014-09-30' AND RepID = 1 Using MSSQL 2012.
I have created one Linked server to fetch the data from Oracle server.
I have two tables at Oracle server
1. EMP_Tbl1 (Emp_Cd VARCHAR2(10))
2. EMP_Tbl2 (EMP_ID NUMBER, Emp_Cd VARCHAR2(10))
I can connect to EMP_Tbl1 table through my linked server at SQL Server 2005.
WHILE I cann't connect to EMP_tbl2.
ERROR: The OLE DB provider "OraOLEDB.Oracle" for linked server "Linked_Facets" supplied inconsistent metadata for a column. The column "EMPID" (compile-time ordinal 1) of object ""SYSTEM"."EMP_ASH"" was reported to have a "DBTYPE" of 5 at compile time and 130 at run time.
OR "The OLE DB provider "OraOLEDB.Oracle" for linked server "Linked_Facets" supplied invalid metadata for column "JOINING_DATE". The data type is not supported."
Is there a way in SQL Server 2000 to extract data from a table, such thatthe result is a text file in the format of "Insert Into..." statements, i.e.if the table has 5 rows, the result would be 5 lines of :insert into Table ([field1], [field2], .... VALUES a,b,c)insert into Table ([field1], [field2], .... VALUES d, e, f)insert into Table ([field1], [field2], .... VALUES g, h, i)insert into Table ([field1], [field2], .... VALUES j, k, l)insert into Table ([field1], [field2], .... VALUES m, n, o)Thanks in advance
I'm new to SSIS and have run into a problem I'm hoping someone can help me with.
Basically, I have a flat file that looks something like:
ID,Type,Description,Results 1,Test1,This is a test,5 2,Test1,This is also a 1 test,7 3,Test1,This is also a 1 test,13 4,Test2,This is a second test,14 5,Test2,This is also a second test,18
I'm trying to normalize the data by extracting out individual rows that have the same "Type" column value. So what I want is to extract each unique type and description into a separate table. This would give me two new rows, one for a type of Test1, and one for a type of Test2, with the descriptions. Does this make sense? Then I could relate the individual results to these test types. In my scenario, I don't care which description is used; I just want to take the first description that shows up with the associated "Type."
Does anyone have any idea of how I could go about doing this? I could pull out all unique "Types" from the rows with the Aggregate transformation, but I'm trying to figure out how to get the description that goes along with it.