While Loading Refering Other Table Values.

Apr 17, 2007

1, abcd, qrs, 1000
2, efgh, tuv, 1000
3, ijkl, wxy, 1000
4, mnop, mno, 1000



lets assume the excel data seems to be above one.


Iam populating to the T1 table (below one) from the Excel source (above data)

Create Table T1(
ID int,
BaID int, -- Foreign Key, BA(ID)
BaBrID int, -- Foreign Key BABR(ID)
Amt int)



When iam populating values for BaID and BaBrid have to refer the respective tables BA(ID) and BaBR(ID) see the below tables.

Create Table BA(
ID int,
BAName varchar(25))



Create Table BABR(
ID int,
BABRName varchar(25))


Could anyonly please help me like which transformation have to use for this and how to use, just give me some tips.


Regards,
Newly to SSIS

View 12 Replies


ADVERTISEMENT

Adding New Content To A Table By Refering Other Tables Using SQL

Jan 5, 2007

I keep product name, id in Table1.
I keep Category name, id in Table2.
I keep relation between product and category (product_id, category_id) in Table3.
I have added some products to the table with proper category.
Work fine
But for some products I did not specified any category
(ie their id  is not present  in Table3)
But now I want all such products
(ie all products whose category is nothing)
 To be associated with category_id 10
 
Can I do this  simply with SQL queries?
 
Hope u can help me
 
sujith

View 4 Replies View Related

Refering To Distinct Values Post(My Other Post)

Oct 22, 2007

---------------------------------------------------------------
My Original Post
I have to query n table(NLRImports) using the Distinct keyword, to retrieve a set of ID numbers. ( "Select DISTINCT id_nbr from NLRImport" ).

Now i want to use those values i retrieved, to process the records in the table(NLRImports) 1 by 1. How do i use those ID no's i retrieved as Variables or parameters for my next query?? If this makes sense?
----------------------------------------------------------------

First, thanks for the response.... now here is what im trying to do.
I created a simple application in delphi to import information to a table in MSSql2005. This is some of the resulting columns...

date | id_nbr | account_nbr | sub_account_nbr | ... etc
-------------------------------------------------------------

Now there will be several entries with the same id no but on different dates, so i take it dates would rather be my pkey.

Then i need to take one person's entries(i work on id_nbr) and go thru all the entries taking the earliest date and comparing all the other entries for that person to the first date and select all the dates more than 19 days after the first date and less than 91 days from first date and place it in a new table.
I used cursor s and while loops to kind of get it going but i know that cursors are not really recommended use but the performance implications dont bother with this particular job.

What other ways should i be using to accomplish this?

thanks, i hope this is clear...

View 1 Replies View Related

Refering Aliases In The Same View/ Query

Dec 6, 2007

HI,
I have a view where I want to add Rundate and Prev Month Rundate as computed columns to simplify my joins and calculations.
Rundate will be a select from another table that has a list of rundates for each month like this.
SELECT MAX(fm_dateend)
FROM dbo.tbl_FiscalMonth
WHERE fm_dateend <= getdate()) AS smalldatetime) AS CurrRunDate
Now, I want to add Prev Month Rundate on the basis of CurrRunDate but it does not accept CurrRunDate. The query is like this

SELECT MAX(fm_dateend)
FROM dbo.tbl_FiscalMonth
WHERE fm_dateend < CurrRunDate) AS smalldatetime) AS PrevMonthRunDate

Can anyone help me to work around with the alias as I dont like to put a whole bunch of code inplace of CurrRunDate(Alias).

Thanks,
Shariq

View 1 Replies View Related

Refering To An Item In Main Report From Subreport

Apr 1, 2008

Hi All,

I have 2 reports where 1 is a subreport and the other one is a main report.
Can i change or refer to a control(item) in the main report depending on the value of an item in the subreport, when the subreport is being run?

Any comments are appreciated.


Thanks in advance.
payal

View 2 Replies View Related

T-SQL (SS2K8) :: Create Union View To Display Current Values From Table A And All Historical Values From Table B

May 6, 2014

I have 2 identical tables one contains current settings, the other contains all historical settings.I could create a union view to display the current values from table A and all historical values from table B, butthat would also require a Variable to hold the tblid for both select statements.

Q. Can this be done with one joined or conditional select statement?

DECLARE @tblid int = 501
SELECT 1,2,3,4,'CurrentSetting'
FROM TableA ta
WHERE tblid = @tblid
UNION
SELECT 1,2,3,4,'PreviosSetting'
FROM Tableb tb
WHERE tblid = @tblid

View 9 Replies View Related

SSIS Loading DWH Staging Area When Table Names Is Selected From Table List

Aug 31, 2007

Hello,
Maybe anyone have done that before?
I have table where i store SOURCE_TABLE_NAME and DESTINATION_TABLE_NAME, there is about 120+ tables.
i need make SSIS package which selects SOURCE_TABLE_NAME from source ole db, and loads it to DESTINATION_TABLE_NAME in destination ole db.

I made such SSIS package. set ole db source data access mode to table or view name variable.
set ole db destination data access mode to table or view name variable. set to variables defoult values (names of existing tables)
but when i loop table names is changed, it reports error, that can map columns, becouse in new tables is different columns.

how to solve that problem?

View 5 Replies View Related

Check Constraint - Compare Sum Of Two Values In One Table Against Values Located In Another Table

Jul 26, 2014

I am relatively new to SQL and as a project I have been asked to create the SQL for a simple database to record train details. I want to implement a check constraint which will prevent data from being inserted into a table if the weight of the train is more than the maximum towing weight of the locomotive. FOr instance, I need to add the unladen weight and maximum capacity of each wagon (located in the wagon type table) and compare it against the locomotive maximum pulling weight (the locomotive class table). I have the following SQL but it will not work:

check((select SUM(fwt.unladen_weight+fwt.maximum_payload) from
hauls as h,freight_wagon as fw,freight_wagon_type as fwt,train as t where
h.freight_wagon_serial_number = fw.freight_wagon_serial_number and
fw.freight_wagon_type = fwt.freight_wagon_type and
h.train_number = t.train_number) <
(select lc.maximum_towing_weight from locomotive_class as lc,locomotive as l,train as t where
lc.locomotive_class = l.locomotive_class and l.locomotive_serial_number = t.locomotive_serial_number))

The hauls table is where the constraint has been placed and is the intermediary table between train and freight wagon.

I may not have explained this very well; but in short, i need to compare the sum of two values in one table against a values located in another table...At present I keep getting a message telling me the sub query cannot return more than one row.

View 2 Replies View Related

Transact SQL :: Update One Table Based On Another Table Values For Multiple Values

Apr 26, 2015

I have two tables  A(uname,address,full_name) and B(uname,full_name). I want to update table A for all matching case of uname in table B. 

View 5 Replies View Related

Rename Table After Loading Data Into Temp Table

Dec 19, 2007

WE have a job that loads data from an Oralce DB into our SQL Server 2000 DB twice a day. The schedule has just changed so that now there is a possibility of having my west coast users impacted when it runs at 5 PM PST and my east coast users impacted when it runs at 7 AM EST. As a workaround, I have developed a DTS package that loads the data into temp tables instead of the real tables. IE. Oracle -> XTable_temp instead of Oracle -> XTable. The load sometimes takes about an hour to an hour and a half to load, so this solution works great, but I want to then lock the table, delete it and rename the temp table to table X. The pseudo code would be:

Begin Transaction


Lock Table XTable

Drop XTable

Alter Table XTable_temp rename to XTable

Release Lock XTable

End Transaction

Create XTable_temp

I see two issues with this solution. 1) I think if I can lock XTable that the lock would be released when the table is dropped and the XTable_temp was being renamed. 2) I can't find a command to rename a table.

Any ideas on a process that might help?


TIA,

A

View 5 Replies View Related

T-SQL (SS2K8) :: Stored Procedure To Truncate And Insert Values In Table 1 And Update And Insert Values In Table 2

Apr 30, 2015

table2 is intially populated (basically this will serve as historical table for view); temptable and table2 will are similar except that table2 has two extra columns which are insertdt and updatedt

process:
1. get data from an existing view and insert in temptable
2. truncate/delete contents of table1
3. insert data in table1 by comparing temptable vs table2 (values that exists in temptable but not in table2 will be inserted)
4. insert data in table2 which are not yet present (comparing ID in t2 and temptable)
5. UPDATE table2 whose field/column VALUE is not equal with temptable. (meaning UNMATCHED VALUE)

* for #5 if a value from table2 (historical table) has changed compared to temptable (new result of view) this must be updated as well as the updateddt field value.

View 2 Replies View Related

Loading A Table Into Memory

Aug 18, 1999

I have a table with several million rows and it gets queried every day by an application. When this happens, it either ties up the server or crashes SQL 6.5 in general. Because of the thoroughness of the query, its understandable. An idea to get around the locking up was to run DBCC CHECKTABLE on this table to put it in cache and run the query.

Will this speed up the process or prevent the locks? Has anyone done this?

Alan

View 2 Replies View Related

Loading Data Into Sql Table

Apr 25, 2008

I want to read file from c:abc.txt through sql programming and Insert this file data into table.

suppose c:abc.txt has following data
aman 10 50,000
sumesh 20 40,000

suppose I have created table abc( a varchar(30), b int, c int)
How I will do it

Thanks
Ajay

View 3 Replies View Related

Loading Data To A Table

Feb 20, 2008

Hi,
I created a package to load a fact table
which loads more than 7 million records.
When loading the table it took nearly 15 minutes.
Then indexes were created for the table at the DB level after which the time to load same number of records has increased.
How to resolve this time delay?

View 4 Replies View Related

Loading Fact Table

Feb 13, 2006

Hi

I have delta loaded all the dimension tables now and each dimension table is related to fact table through a surrogate key, How do i further load a fact table. Please tell me I am stuck up here.. :( .

If any one has an example to refer please do tell me

View 2 Replies View Related

Help Loading A Text File Into Db Table

Feb 12, 2001

I am familiar with the MySQL Load Data command to load an external ascii file into a database table, but am having trouble finding a T-Sql command that is equivalent without creating an executable...any help would be appreciated...

View 1 Replies View Related

Problem Loading A Sqlce Table

May 2, 2008

I've got a db table, that I created in Sever Studio Management and I can se all the data and everything the
problem is that when I load it to the movile device (windows mobile 5.0) it says that the table is NotAble
but in the management works fine, I can't even do a "select * from table", and if you check the query analyzer
you se the table but it has no columns.

View 2 Replies View Related

Help Help : Error Loading Fact Table

Jan 3, 2008



Hi
I am strugglinh since last 2 days .SSIS is giving me torrid time

I am getting error while loadding the fact table

[Destination Fact Table [1099]] Error: An OLE DB error has occurred. Error code: 0x80040E21. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".
[Destination Fact Table [1099]] Error: The "input "OLE DB Destination Input" (1112)" failed because error code 0xC020907B occurred, and the error row disposition on "input "OLE DB Destination Input" (1112)" specifies failure on error. An error occurred on the specified object of the specified component.
[DTS.Pipeline] Error: The ProcessInput method on component "Destination Fact Table" (1099) failed with error code 0xC0209029. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.



Please help

I have already googled for this error and appied whatever tips were given.

View 5 Replies View Related

Loading A Table Var Into A SSIS User Var?

Mar 12, 2008



I'm using an Execute SQL Task Editor to try and load the last load date into a user var. I don't know what I'm doing wrong.

I have result set to Single Row and a simple query:

SELECT LastLoad
FROM HeidtmanDW.dbo.CubeLoadStats
WHERE (SourceTable = 'Sales')

Where do I set the user var User:LastSalesLoadDate (which is scoped to the entire packge)?

Thanks.

View 6 Replies View Related

Fast Loading Of Data To Table

Jul 10, 2007

Hi Every one,

How can I load or copy say millions of rows to a table in the database faster?

Thanks,
Mejo George

View 6 Replies View Related

SQL Server 2012 :: Replace All Values In String With Values From Look Up Table

Mar 19, 2014

I have a table that lists math Calculations with "User Friendly Names" that look like the following:

([Sales Units]*[AUR])
([Comp Sales Units]*[Comp AUR])

I need to replace all the "User Friendly Names" with "System Names" in the calculations, i.e., I need "Sales Units" to be replaced with "cSalesUnits", "AUR" replaced with "cAUR", "Comp Sales Units" with "cCompSalesUnits", and "Comp AUR" with "cCompAUR". (It isn't always as easy as removing spaces and added 'c' to the beginning of the string...)

The new formulas need to look like the following:

([cSalesUnits]*[cAUR])
([cCompSalesUnits]*[cCompAUR])

I have created a CTE of all the "Look-up" values, and have tried all kinds of joins, and other functions to achieve this, but so far nothing has quite worked.

How can I accomplish this?

Here is some SQL for set up. There are over 500 formulas that need updating with over 400 different "look up" possibilities, so hard coding something isn't really an option.

DECLARE @Synonyms TABLE
(
UserFriendlyName VARCHAR(128)
, SystemNames VARCHAR(128)
)
INSERT INTO @Synonyms
( UserFriendlyName, SystemNames )

[Code] .....

View 3 Replies View Related

SSIS Error When Loading Access Table Into SQL

Feb 20, 2008

Below is the error, Thanks!!
[Data Conversion 1 [157]] Error: Data conversion failed while converting column "Media Type" (89) to column "Media Type" (201).
The conversion returned status value 4 and status text "Text was truncated or one or more characters
had no match in the target code page.".

[Data Conversion 1 [157]] Error: The "output column "Media Type" (201)" failed because truncation occurred, and the
truncation row disposition on "output column "Media Type" (201)" specifies failure on truncation.
A truncation error occurred on the specified object of the specified component.

[DTS.Pipeline] Error: The ProcessInput method on component "Data Conversion 1" (157) failed with error code 0xC020902A.
The identified component returned an error from the ProcessInput method. The error is specific to the component,
but the error is fatal and will cause the Data Flow task to stop running.

[DTS.Pipeline] Error: The PrimeOutput method on component "Source - Test" (1) returned error code 0xC02020C4.
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.

View 11 Replies View Related

Loading Records In One Table To Multiple Tables

Aug 18, 2007

Data_Staging:
Unique_id
Gender
Ethnicity
Race
MCP_key
Admission_Dt
Discharge_Date
Enrollment_key
Reason
Disability
Income
Employment


I need to load the data from this table to three different tables all have foreign key relationship

Registration Table:
Registration_key ( Indetity) -PK
Unique_id
Gender
Ethnicity
Race

Episode:
Episode_Key(Identity)- PK
Registration_key (FK)
MCP_key
Admission_Dt
Discharge_Date

Assessment Table:
Assessment_Key(Identity) €“ PK
Registraion_Key(FK)
Episode_Key(FK)
Enrollment_key
Reason
Disability
Income
Employment

View 1 Replies View Related

Loading Crosstab Data Into Database Table

Oct 29, 2007

Hi, there,

I have a Excel cross-tab (multilevel column) report that need to be loaded into a database table. Currently, I am using a Excel macro that convert the columns into rows before loading into the database table. I was thinking whether there is a better way of doing this perhaps in SSIS or using XML.

Any ideas greatly appeciated.

Thank you.

Yong Hwee

View 7 Replies View Related

C# Code Or Document For Loading Excel Sheet Into An Sql Table

Dec 3, 2004

Hi,

I am trying to find some document or code that will load an excel spreadsheet into an sqlserver database.

Can anyone please point me in the right direction.

View 2 Replies View Related

Need Suggestion On Loading A 50 Million Records Table From Oracle

Feb 16, 2006

All,

I need to load a 50 million records table monthly. Any suggestion about the best/fast way to do it?

Thanks a lot

View 2 Replies View Related

JDBC - How Robust? Loading ResultSet Into SQL SERVER Table

Apr 24, 2008



I have a program that I'm working on that utilizes a JDBC connection to a SQL 2005 server. A result set is generated from a legacy system. The data that is pulled into this result set is in the same layout as a table in SQL 2005 server.

My question is, once I have good data loaded into the ResultSet object can I pass it to the JDBC to load it into the table?

Or do I have to use the ResultSet.get(string) to pull out each value row by row, populate a string, and then use the string in an insert statement that I pass to JDBC?

Are there tricks or optimizations I can do for this type of JDBC transfer?


--Thanks--


View 1 Replies View Related

SQL Server Configuration Table Runtime Loading Problem

Jun 8, 2007

The package works fine in development site. It was compiled with "Enable package configurations" and sql server as configuration type. But after installed in production database using deployment manifest, the package does not load the configuration values at run time from the table, instead it uses the variables' value in design time.



If the configuration is a file in windows folder, I may be able to load it from the sql job agent's step configuration tab. When configuration values are stored in a table, how can I make it load the configuration from there at run time?

Thanks.

View 5 Replies View Related

Integration Services :: Loading PGP File Into Table Using SSIS

Oct 13, 2015

I have a load a zipped folder which is PGP encrypted into SQL table, How to unzip and load it into sql table using SSIS.

View 4 Replies View Related

SQL Server 2008 :: Loading Data Into New Partition Table Online

Mar 1, 2015

When you load the data into a new partition table, can it to done online without any downtime? because I have few tables that are around 250 gigs and more.

View 5 Replies View Related

Table Identification - Find Stored Procedure That Is Actually Loading Data

Aug 7, 2013

I have a table which is referenced in multiple stored procedures .Among them only one procedure loads data (INSERT statement) to the table. In all other procedures table is referenced in FROM clause.

My question is how do i find the stored procedure that is actually loading data into that table.

View 19 Replies View Related

Correcting Invalid Dates From A Text File Before Loading SQL Table

Apr 8, 2008

Each month we process 100+ text files into our ERP system. Occasionaly the Voucher Date in the text file does not contain a valid date. I would like to check to see if it is a valid Date, if it isn't replace it with the current date.

I thought I would use a Derived Column transformation, but I don't know how to check a field to see if it is a valid date.

Can anyone help?

Thanks,

Jeff

View 3 Replies View Related

Loading The Different Language Data From Excel File To The Single Table

Feb 29, 2008

can anyone help me to solve this problem
i have created a ssis package to load the data from excel file to the table, but we are getting the data in different language ie in french,english and in china after loading the data when we view the data it is showing as junk characters for chinese data but we are able to see other language data ie french and english.
so please tell me how to solve that
reply to my mail id(sandeep_shetty@mindtree.com)

View 11 Replies View Related







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