Matching Values In SSIS
Apr 25, 2008
Hi,
I have a table of parts which has a Tag column. The table is such that two parts can share a tag (but no more than two parts), essentially pairing them. I would like to use SSIS to match the parts based on this column value, so that I can add these into a new table.
For example, I could have:
(part1, tag-123, "a random part", serial123) and
(part2, tag-123, "another random part", serialxyz)
in the table, and would then concatenate the pair to enter into a new table, such that I have:
(part1, tag-123, "a random part", serial123, part2, tag-123, "another random part", serialxyz)
I'm new to SSIS and am unsure how I could achieve this, so if anyone could show me how I would appreciate it.
Thanks,
Simon
View 3 Replies
ADVERTISEMENT
Feb 20, 2006
I apologise if this is a stupid question, but I would appreciated anyhelp on this subject.I want to create a view (VIEW_1 in example below) where I take numericvalues from a field in one table (DEPTH_FROM in TABLE_1) and find theclosest matching values from another field in another table (DEPTH_ATin TABLE_2) - the higher matching value and the lower matching value.TABLE_1BH_ID DEPTH_FROMB1 10.6B1 14.2B1 16.1B1 17.0TABLE_2BH_ID DEPTH_ATB1 9B1 10B1 11B1 12B1 13B1 14B1 15B1 16B1 17B1 18VIEW_1BH_ID DEPTH_FROM DEPTH_LOWER DEPTH_HIGHERB1 10.6 1011B1 14.2 1415B1 16.1 1617B1 17.0 1717Any assistance would be appreciated.Regards,Hennie
View 2 Replies
View Related
Apr 25, 2008
Hello, all.
I am new to SQL querying and I came across an issue while experimenting.
Say, I have two tables like the following, a Users table at the top, and a Roles table at the bottom (drawing the issue as I'm not fluent in English to explain):
(Users table)
UserId | RoleId | RoleOldId
-------+--------+----------
1......|x.......|11........
2......|y.......|22........
3......|z.......|22........
(Roles table)
RoleId | RoleOldId | RoleName
-------+-----------+-------------
10.....|11.........|Anonymous....
20.....|22.........|Superuser....
30.....|33.........|Administrator
The Roles table was changed to include a new column Roles.RoleId and the old column is named Roles.RoleOldId. Same is done for Users table.
Assume these are not foreign and/or primary keys. How can I fill Users.RoleId with new Roles.RoleIds, matching RoleOldIds at each tables? The resulting (x, y, z) set of Users table will be (10, 20, 20).
Thank you for your time.
View 3 Replies
View Related
Apr 2, 2015
I have tables in my database, tblNames1, tblNames2, tblNames3 for ex, and for addresses tblAddresses, can I match the address IDs in the names tables to the address table based on the values of a field? In this case CompanyName. Can they be matched automatically? My issue is that I have a huge CSV file with all the address information that needs to be assigned a foreign key based on the company name field which is also present in all the names tables, all the names are normalized.
View 1 Replies
View Related
Mar 22, 2008
I need to write a statement that returns the name, city, and state of each vendor that’s located in a unique city and state. In other words, I can not include vendors that have a city and state in common with another vendor.
Any help?
Thanks.
View 2 Replies
View Related
Aug 25, 2006
I want to check for multiple patterns in a particular column.
For one pattern I can write e.g.
SELECT * FROM <TablName> WHERE ColumnName LIKE '%abcd%'.
My requirment is to select all rows for which column value matches with many patterns.I will fetch the patterns in a subquery
e.g. (SELECT '%'+name+'%' FROM <TableName>)
Any thoughts?
View 10 Replies
View Related
May 20, 2014
We have 2 tables (table a and b)
select a.* from table a inner join table b
on a.col1<> b.col2
I would like to have column names where the values are not matching.
View 4 Replies
View Related
Mar 31, 2014
I have 3 table
table_A
table_B
table_C
TABLE_A
SNO NAME ID
1 RAJU 070491
2 VAMSHI 089767
3 ARUNA 068908
TABLE_B
SNO NAME ID
2 RAJU 070491
4 JKLKJ 098766
I WANT COMPARE TWO TABLES(TABLE_A & TABLE_B) SELECT TABLE_A MATCHING VALUES COPY IN TABLE_C
EX-
SNO NAME ID
1 RAJU 070491
View 3 Replies
View Related
Nov 6, 2007
Hi all sql gurus,
I have a table that has product name and submissionID and some other columns. I am really concerned about these two columns. My task is to get all the submissionIDs for a particular product name and display SubmissionIDs seperated by commas against each product name .
The tables below might give a better idea
current scenario:
Product Name SubmissionID columnC Column D
AAA 123
AAA 456
BBB 111
ccc 121
AAA 789
Expected result:
Product Name SubmissionID columnC Column D
AAA 123,456,789
BBB 111
CCC 121
Any suggestions/pointers would be highly appreciated.
View 5 Replies
View Related
Jan 26, 2007
I want to write a statement something like this
SELECT Add_Date, File_No FROM dbo.File_Storage WHERE (File_No = 11/11/1234/)
But i want the search to ignore the first 2 digits so that it will return e.g
10/11/1234, 09/11/1234 so that it's only matching the last part
Any Help Would be greatly appreciated Thanks
View 6 Replies
View Related
Jun 29, 2015
I have tables and a function as representated by the code below. The names for objects here are just for representation and not the actual names of objects. Table RDTEST may have one or multiple values for RD for each PID. So the function GIVERD will return one or multiple values of RD for each value of PID passed to it.
When I run the following query, I get the required result except the rows for CID 500 for which PID is NULL in table T1. I want the rows for CID 500 as well with PID values as NULL.
SELECT A.CID,
A.ANI,
A.PID,
B.RD
FROM T1 AS A CROSS APPLY GIVERD(A.PID) B
CREATE TABLE [DBO].[RDTEST](
[PID] [INT] NULL,
[RD] [INT] NULL
)
[Code] ....
View 4 Replies
View Related
Jan 9, 2008
How would you do the following in SSIS?
SELECT a.TestID,
a.TestCode
FROM TableA a
WHERE UPPER(RTRIM(a.TestCode)) IN SELECT (SELECT UPPER(RTRIM(b.TestCode)) FROM TableB b)
Of course the above query is missing a few things but with ETL the where clause UPPER(RTRIM does not appear to be something that has an object or property that I can use in the Lookup.
Please correct and educate me.
View 4 Replies
View Related
Feb 4, 2007
Hi All
I have a strange request that might not be possible based on the laws of relational databases but I thought I'd give it a try.
I have three tables which for simplicity I will call A, B and C. Table A contains my master records, Table B contains user details and the final table contains some extra data
In my initial search when joining A and B, I return 100 records. I then need to search in table C for these 100 records based on a criteria. the expected result should return all 100 rows for the ones that match and also the ones that do not match. The problem is that in Table C, not all the 100 IDs exist, so there will not be a corresponding record. Unfortunately, our users still want to see all 100 records in the output. Is this possible
As always any help or direction would be appreciated.
View 5 Replies
View Related
Jan 23, 2008
Hi All,
I receive the input file with some 100 columns and some 20k+ rows and I want to check the incoming input row is existed in the database or not based on 2 key columns. If the row is existed then I need to check all the columns (nearly 100 columns) values in input and the database are equal or not. If both are equal I need to treat them seperately if not there is a seperate logic. How Can I do that check for each row and for each column?
Basically the algorithm is like this, if the input file row is not existed in the database then treat that as new row else if the input row is existed in the database then check all the columns are equal or not. If all the columns are equal then treat that as existing row and do nothing else if some columns are not equal then treat this row seperately.
I found some thing to achieve the above thing.
1. Take the input row and check in the database.
2. If the row is not found in the database then treat it as new row.
3. If row is found in the database then
a) Take the source row and prepare a concatenated string for all the columns
b) Take the database row and prepare a concatenated string for all the columns
c) Find out the hash code for the 2 strings and then compare hash codes for equal.
The disadvantage of this is running a loop 2*m*n times where m is the number of rows and n is the number of columns. It should be done 2 times for input file row and database row.
Can anybody suggest a good method to do this?
What does the function "GetHashCode" for InputBuffer in method "Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)" will do?
Will it generates hash code based on all the columns values?
Pls clarify.
Regards
Venkat.
View 1 Replies
View Related
Dec 9, 2013
I have SQL Server 2012 SSIS. I have Excel source and OLE DB Destination.I have problem with importing CustomerSales column.CustomerSales values like 1000.00,2000.10,3000.30,NotAvailable.So I have decimal values and nvarchar mixed in on Excel column. This is requirement for solution.However SSIS reads only numeric values correctly and nvarchar values are set as Null. Why?
CREATE TABLE [dbo].[Import_CustomerSales](
[CustomerId] [nvarchar](50) NULL,
[CustomeName] [nvarchar](50) NULL,
[CustomerSales] [nvarchar](50) NULL
) ON [PRIMARY]
View 5 Replies
View Related
Sep 3, 2015
I have an SSIS package that imports data from an Excel file, replaces any value in Excel that reads "NULL" to "", then writes the data to a couple of databases.
What I have discovered today, is I have two columns of dates, an admit date and discharge date column, and what I need to do is anywhere I have a null value in the discharge date column, I have to replace it with the value in the admit date column.
I have searched around online and tried a few things using the Replace funtion in Derived columns but no dice so far.
View 3 Replies
View Related
Jan 10, 2007
I have run into a situation executing SSIS packages when the Source is a mainframe database using an ODBC driver. It appears that SSIS just stops running when it hits a row with low-values and does not always give a meaningful message. Is this true that SSIS package will just stop processing rows of data if it hits low-values?
View 7 Replies
View Related
Sep 17, 2015
I came across the below scenario in SSIS where the values are not getting rounded off in SSIS as expected.
I am passing the value 23007.945 and using a derived column expression to round off the value Round(number,2).
Placed a data viewer to view the outcome after the derived column expression.Value after derived column expression seems to be 23007.94 but the same when passed in SQL select round(23007.945,2) gives us the value as 23007.95.
What could be causing this?
View 0 Replies
View Related
Feb 8, 2007
I am trying to load a SQL 2005 table that consists of two guid values in two fields. I have a flat file in tab delimited form that has guid values as strings to load into the table. I used a flat file source module in SSIS; which then goes to a Data Conversion module that takes the flat file and does a conversion to type unique indentifier [DT_GUID]; this goes to a OLE DB destination which is a SQL 2005 table that has no records and only those two fields. I get this following primary error:
[Data Conversion [498]] Error: Data conversion failed while converting column "Column 0" (373) to column "Copy of Column 0" (511). The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
An example of the two values in the .txt flat file source:
84d92cbb-4b4b-435b-8d8a-789ea930283c 328340cd-85fd-4210-8d82-000024093d7c
Any ideas what may be causing this? This should be pretty straight forward load. But it is guid which seems to always cause cast issues.
View 4 Replies
View Related
Apr 16, 2008
Since SSIS is developed in Visual Studio is there a way to view the variable values as they are passed into SSIS? In Visual Studio I know if you hover over the variable a popup appears with the value in the variable.
I am having an issue with a variable value that is supplied through an "Execute SQL Task" it is a Directory path that is entered in through the application and used to determine where to pick up files to transfer. I have entered in the path using Fully Qualified(D:ImportExportCentralPrinting) and UNC (\SQLDEVELOPImportExportCentralPrinting) through both methods SSIS is telling me no files are available in the directory path. When I know for fact they do exists.
I would really love to see the variable values that are being used can anyone out there help?
Thank you all,
Mike
Michael Alawneh, DBA
View 3 Replies
View Related
Jun 1, 2006
Hi
Does anybody know how to pass values from asp dot net to SSIS package variables ?
Currently I have an SSIS package for monitoring windows service... for that...
I have to pass the Server-IP Addrress, UserName, Password, Service Name as Parameter.
I would like to pass these parameters through an Interface from RUN TIME.
Please help this problem
Regards
Deepu M.I
View 1 Replies
View Related
May 27, 2008
Hi,
I am trying to create an SSIS package but am not able to set the global variable values.
I want to have a Global Variable as @EventID
and the create a Execute SQL Task which will run this query:
SELECT Max(EventID)
FROM EventTable
and assign this Max value to the global variable @EventID
How can I achieve this...help me please
Regards,
Nusrath
View 1 Replies
View Related
Sep 17, 2015
I came across the below scenario in SSIS where the values are not getting rounded off in SSIS as expected.
I am passing the value 23007.945 and using a derived column expression to round off the value Round(number,2).
Placed a dataviewer to view the outcome after the derived column expression.Value after derived column expression seems to be 23007.94 but the same when passed in SQL select round(23007.945,2) gives us the value as 23007.95.
What could be causing this?
View 4 Replies
View Related
Oct 15, 2007
I have 4 packages in one solution. I have created one configuration table in SQL server for all the packages. For each package, I have a different configuration filter in the same table. Everything works fine in the development environment.But when I create a deployment utility and deploy the packages, the values are not picked from the configuration table although I have re-created the configuration table in the new database.It tries to pick up the values from the database used in the development environment and thus it fails. I have changed all the connection strings in the package after deployment but still of no use.
I am not getting where I am going wrong. Any help would be highly appreciated.
View 3 Replies
View Related
Sep 22, 2015
Send Mail has priority values as Normal, Low and High. How do I translate this to integer values? I am creating a custom Send Mail script and would like to assign the email priority.
View 2 Replies
View Related
May 30, 2007
I've got an SSIS package that works fine. It does extracts from a foreign ODBC source and moves it to SQL Server. It has 3 variables, a customer ID, a fromDate and a toDate. Those variables are used to complete a SQL statement expression. So far so good.
I now want to provide a web interface in a web page that will enable the user to provide values for those variables. How can I execute my package passing the user's input?
Thanks for any advice.
Lou
View 3 Replies
View Related
Jan 8, 2008
Hi, how do I convert dates with SSIS, when I receive dates I have no problem, with empty fields I have to go through a transformation as:
trim(field_name) == "" ? "999999" : substring....... (derive transform)
after this I have to update each field holding '999999' to NULL. (using sql task)
Is there an easier way to doing this?
Thanks
View 1 Replies
View Related
Sep 4, 2007
Hi, i'm new to SSIS and trying to import some csv files (comma delimited) into SQL Server. A NULL value for a CHAR column is correctly regonized as NULl in SQL Server, but a NULL value for of a mapping to a VARCHAR column in SQL Server is not recognized correctly and i get the value "'NULL'" in SQL Server (including the single comma.
Sample:
CSV file contains columns A and B. A and B contains the Text NULL.
Column A is mapped to a CHAR field, and column B is mapped to a VARCHAR field in SQL Server.
After the import, SQL has the following value: A = NULL as NULL, B 'NULL' as text.
did anyone else had this problem?
thanks so much for any help.
View 4 Replies
View Related
Oct 13, 2015
At one of my accounts I'm using SQL 2008r2 and SSIS in an DWH solution. Today I wanted to created a dynamic sql statement in one of the packages. The dynamic part is in the where-clause a sql query I use. I want to set the values for this clause dynamically. Therefor I created a user variable (named 'Filter') which should get it´s value at run-time.
/DTS "MSDBProdMy Package" /SERVER "My-Server" /CHECKPOINTING OFF /REPORTING EW /SET "Package.Variables[User::Filter].Properties[Expression]";" where [Starting Date] < '2008-09-01 00:00:00.000' "
However when I execute this package with dtexecui it doesn not use the value specified after the /SET parameter, but instead uses the value specifiied at design time. I get the same when I add the execution of ths pacakage as a sql server job step (type SSIS). I would expect that value specified after the /SET parameter would overwrite the valus specified at design time, but I don't see that happening.
View 5 Replies
View Related
May 12, 2015
I am trying to insert in table using execute sql task.
I want to pass value of Load_Frequency through parameter
But I am getting below error
[Execute SQL Task] Error: Executing the query "Insert Into [dbo].[ETL_LOAD_MAIN] (
[Load_Fr..." failed with the following error: "The statement has been terminated.". Possible failure reasons:
Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Insert Into [dbo].[ETL_LOAD_MAIN] (
[Load_Frequency]
,[Load_Start_DateTime]
,[Load_Overall_Status]
) Values (?,getdate(),'In Progress')
View 2 Replies
View Related
Jul 19, 2006
We are using BCP in a Process task. The value for the path to BCP's error log requires double quotes around it. We initially put this value in a configuration file, and that worked fine. Yesterday, we eliminated the config file and tried to use the "Set Values" tab of the SSIS SQL Server Agent job to pass in this value.
The package variable was assigned the value of the path -- all except for the leading double quote. The closing quotation mark was included in the value.
We tried adding a second double quote at the beginning of the value, but that caused the job to fail immediately.
For now we will work around this problem by putting the quotes around the value in a Script task inside the package.
Has anyone else encountered this problem?
Thanks,
Ron
View 2 Replies
View Related
Sep 6, 2006
I am working on a project that is creating a new application, my area of the project being the migration of data from the old application database, transforming it, and populating the new database.
The transformations to the old data are done in a staging database.
At the end of the process, the staging database ends up with a lot of new applications tables, populated with the migrated legacy data.
We need to move these tables from the staging database to (initially) our test databases, but ultimately what will be the live database.
We have tried using the "Transfer SQL Server Objects Task" in SSIS, but have ran into a problem that a lot of the database tables have default values for columns.
These default values are not brought over.
Example. Tables contain a "GUID" field, which has a default of value of newid()
Right clicking and the table generating the CREATE script generates
[GUID] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [DF_tbCRM_Client_GUID] DEFAULT (newid()),
However, the Transfer objects task does not create this default of newid()
Examining the SQL generated by the Import / Export Wizard when investigating this shows that the wizard generates this column as
[GUID] uniqueidentifier NOT NULL
and the column default value is lost.
Is there something i should be setting somewhere to force SSIS to bring these column definitions over correctly?
View 10 Replies
View Related
Jul 16, 2015
Can I assign values to variables in 2012 using below command? I have used the same command in 2008 and it works fine.
DTEXEC
/SERVER"XXXXXXXXSQLSERVER2012"/SQL"Mypackage.dtsx"/SETPackage.Variables[FilePath].Value;"C:Test estvariable.csv"
Wondering is there a different way in 2012 to pass values to variables dynamically.
View 2 Replies
View Related