Updating By Default/specific Values

Apr 5, 2007

In my datawarehouse fact table I have a column (revenue) that I want to populate based on the values of number of columns, for simplicity, say just 2 columns, 'productid' and 'affiliateid'.

I have a revenue lookup table, with those same 2 columns and the amount. So far so simple, but rather than have one row for every possible combination, I use 0 to mean default. For instance, all the affiliates have the same revenue value apart from a couple, so instead of 200 rows identical except for the affiliateid, I have one row with a '0' for the affiliateid and 4 rows with specific affiliateIDs where it differs from the default.

E.G.

AffiliateID, TypeID, Revenue
0, 1, £50
22, 1, £55
33, 1, £57
0,2,£60
22, 2, £66
33, 2, £69


To update the values, I join to the revenues table twice, one for both columns matching, and once for the default. I.E.

UPDATE facttable SET revenue = ISNULL(rev1.revenue, ISNULL(rev2.revenue,0))
FROM facttable FT
LEFT OUTER JOIN revenues rev1 ON FT.AffiliateID = rev1.AffilateID and FT.TypeID = rev1.TypeID
LEFT OUTER JOIN revenues rev2 ON rev1.AffilateID = 0 and FT.TypeID = rev1.TypeID
(In fact, this is over-simplified, because in fact there are 3 columns, so I have to have 8 joins like this).

This works very well, and cuts down the management of revenues significantly, there are a few 100 rows instead of the more than 100,000 there would be if I put every possible combination of values in its own row.

However, now there is a requirement to increase the granularity of the revenue allocation up to 5 columns, which makes 36 joins and there could well be more columns added later.

Has anyone come across a situation like this (and found a neater solution).

View 2 Replies


ADVERTISEMENT

Transact SQL :: Select Specific Values From All Rows Where Value Of A Specific Column Is (Active)

May 23, 2015

I need to select specific values from all rows where the value of a specific column is "Active"

This part works: SELECT LastName, FirstName, MiddleInit, ClientId FROM dbo.Client

But I want to add: WHERE StatusType = (Active) and how to do this.

View 4 Replies View Related

Updating A Specific Cell In An Excel From Sql

Sep 25, 2006

Is there a way to update a specific cell(s) in an excel? I have an excel with charts and graphs which use as data source a range of cells from another sheet within the same spreadsheet. Is there a way update a specific cell from within the sql using openrowset()... ?

thanks

View 1 Replies View Related

A Default Value For A Specific Field/s

Mar 25, 2008

hi, please help me, i have a data driven  site, i made a field that i call "Status"so this is how it should happens, there are three different gridviews in a single page, gridview1 filter is [status] = ok, gridview2 filter is [status] = fine, gridview3 filter is [status] = complete, so all gridview has its own  <asp:hyperLinkField> at first the value of "Status" is ok, so it will appear in the gridview1, so when the user click on the <asp:HyperLinkField> of gridview1 it will go to a new page with a form view, this page has a button that when click will change the value of the status field to "fine", so that it will no longer appear to the gridview1 but it will now appear to gridview2 and same with the next <asp:HyperLinkField> click until it appears to the final gridview. so my question is how can i make the button that is capable of changing (update) the value my database field (status) to a specific value, that is not visible to the user thru codebehind or plain asp.net codes. please help me, if you need more info just reply.ThanksSALAMAT PO! 

View 1 Replies View Related

Updating Specific Col's Based On Data Availablity

Jul 20, 2007

Hi,

DONT KNOW IF IT IS POSSIBLE.. PLEASE SUGGEST.

Currently working on a upload module where in the data from excel file is imported to the destination tables. Data in the excel sheet comes in phases. All excel sheet columns data don't come at first shot. The excel sheet's data is dumped into temporary tables which inturn is looped using cursor's and gets finally updated to the actual tables.

Now, the problem I am facing is how do I update columns of the actual table with the data (i.e NON NULL values) available in the temporary table without tampering the data allready present in actual table.

Ideally what required is, update the actual table column values with the corresponding columns of temporary table ONLY for Non NUll column values of temporary table.

Temporary and Destination tables have 85 columns each. I don't want to write 85 update queries.

The scenario which I am facing is given below with 2 columns as an example.


1. Table 1 :- tbl_source (Temporary Table) has two columns src_Col1 & src_Col2
2. Table 2 :- tbl_destination (Actual Table) has two columns dest_Col1 & des_Col2


Scenario -1
---------------

tbl_Source Sample Data (after excel import to the temporary table)
------------------------

src_Col1 src_Col2
------------------
50 NULL


tbl_Destination Sample Data
------------------------

dest_Col1 dest_Col2
------------------
50 NULL



Scenario -2
---------------

tbl_Source Sample Data
------------------------

src_Col1 src_Col2
------------------
NULL 100


tbl_Destination Sample Data
------------------------

dest_Col1 dest_Col2
------------------
50 100


One update query which handles both scenarios.


Thanking you in anticipation.

Regards

View 4 Replies View Related

Any Way To Find Out Which SP Is Updating Data In A Specific Table?

Sep 22, 2005

Can you create an UPDATE TRIGGER and use some typeof code to figure out which SP just updated the current table?If not how can i achieve what i want?I tried to run SQL Profiler and i don't understand why i can'tsimply have the Profiler filter events only for the specific database idand the table's object id i chose?What am i doing wrong with SQL Profiler? I was testing thisthrough SQL EM. I had the filters chosen for a specific database idand a specific table's object id, yet when i open another table SQLProfiler captures that information too.Thank you

View 2 Replies View Related

Updating A Specific Amount Of Records In A Table

Jun 20, 2007

I have a table with 35,000 records in it. I want to update a value in column A for only the first 5000 records, leaving the value in Column A for the remaining 30,000 records as it is now. What would be the command I would use to update Column A for the first 5000 records.

Thanks,

View 4 Replies View Related

How Do I Enter In A Default Values For A Report Parameter That Accepts Multi Values

Apr 11, 2008



I have my stored procedure set to
Territory_code IN (@Territory)

, now , how do i enter in more then one value. When i select the multi value check box, it gives me more spaces. But then doesnt recognize the values when i put in more then one. am i doing something wrong?

The field is a Varchar 20

View 1 Replies View Related

Updating Specific Columns If That Column Is Equal To A Value In One Query?

Dec 8, 2006

I want to set a column to 0 if it is set to a certain number. There are several columns to check though, so I am wondering if I can do it all in one query, or if I have to do it in single queries?

here is an example:

account | contact_id_1 | contact_id_2 | contact_id_3
433 | 67 | 23 | 67

so I want to set any contact_id_N = 0 where contact_id_N is = 67

so in the end, the table will look like this:

account | contact_id_1 | contact_id_2 | contact_id_3
433 | 0 | 23 | 0

is there a way to do it in one statement?

View 2 Replies View Related

Updating Specific Columns Through A Stored Procedure At Runtime

Feb 25, 2008

I have a question. I know its possible to create a dynamic query and do an exec @dynamicquery. Question: Is there a simpler way to update specific columns in a table at run time without doing if else for each column to determine which is null and which has a value because i'm running into a design dilemna on how to go about it.

FYI: All columns in the table design are set to null by default.

Thanks in advance,

Dimeji

View 4 Replies View Related

SQL 2012 :: Find Out Values Of Parameters When SP Is Executed With Default Values?

May 30, 2014

I am working with SP. How can we find out values of parameters when the SP is executed with the default values?

View 9 Replies View Related

How To Default Drop Down List To A Specific Value In Database

Oct 21, 2014

I have a drop down list that is populated by a stored procedure which has two int parameters (ID, STATUS). I need to default the drop down list to a value in the database that is associated to the ID & STATUS parameters.

The problem I am having is that it only works if the selected value is the first record on the drop down list. for any other records (outside the first record) from the drop down list i get "The 'SelectedIndex' and 'SelectedValue' attributes are mutually exclusive."

Here is the stored procedure I am using to populate the drop down list:

ALTER PROCEDURE [dbo].[usp_SelectName]
(
@pId Int,
@pStatus Int
)
AS
BEGIN
IF @pId = -1 --THIS VALUE IS USED AS DEFAULT (NOT POSTBACK)

[Code] ....

Here is the TABLE_NAMES that holds the data for the drop down list:

IN_ID IN_NAMESTATUS
6 New 0
4 Generic 0
3 Local 1
4 Storm 0

This is the TABLE_2 that holds the complete collected FORM data that has the selected record IN_ID from the TABLE_NAME:

ID STATUS IN_ID
111906
114406
114505
114606
114706

View 4 Replies View Related

Default Values Does Not Include All The Values (Cascading Parameters)

Mar 18, 2007

A have a multi-valued parameter (B) which is dependent on a single-valued parameter (A) on my report. When a value is selected in A, I want all matching values in B to be selected by default and the "Select All" option checked. To do this I have set the Default Values section in B to point to the same dataset as the "Available Values" section. Both A and B have default values so the report runs automatically.

One of the values in parameter A (say Value1) yields more values in parameter B than the other (say Value2).

If I run the report the first time with Value1 selected as the default for parameter A, all values in B are checked correctly. If I run the report with  Value2 selected the first time and then change the selected value to Value2 and run my report, all values in B are displayed but only the values that were previously checked (when Value1 was selected), are now checked, leaving the "Select All" unchecked.

What am I doing wrong? Why are all the values in B not checked? The dataset is the same in "Available Values" section and "Default Values" section.

 

View 8 Replies View Related

SQL Server Admin 2014 :: Updating Statistics On Specific Indices Script

Aug 8, 2015

I'm looking for a quick script that someone has already written to update statistics (not to rebuild or re-organise) on specific indices in specific databases - I guess loop though a table comprising of a list of databases and the indices.

I know Ola has one but I'm not look for something that is that complicated. If I cannot find one I'm going to have to write one myself - I want to try and avoid re-inventing the wheel as tomorrow I have to do this work and it's about 7K plus indices in about 10+ databases.

View 2 Replies View Related

SQL 2012 :: Updating A Column By Default Based On A Rule?

Oct 26, 2015

CREATE TABLE EDI_data_proc_log(
ID int IDENTITY(1,1),
comment VARCHAR(3000),
time_recorded DATETIME DEFAULT GETDATE(),
run_by varchar(100),
duration int );

When a record is inserted I like the duration column to be computed.This should happen only after the first record to the table has gotten inserted.You might say a trigger would be the best.. Ok then, show me the syntax.

Or I am thinking can we write a user defined function that will compute the value for the duration column.

--By default, I would like to update the duration column as follows:

--It should record the number of seconds between the last insertion ( You can get that time from the time_recorded column from the previous record and the current time can be obtained from the getdate() function )

View 2 Replies View Related

Getting Specific Values.

Jun 10, 2008

Hi Everyone.

Looong story short. I have a screen with search criteria. Right.

I have table :
tblCandidateLicense
intPkCandidateLicenseID (PK)
intFkCandidateId
intFkLicenseTypeID

And Another table
tblLicenseTypeDef
Columns:
intPkLicenseTypeID (Pk Int)
strDescription
strLicenseCode
intRank (just for ranking)
intRankParent (for grouping types of vehicles)

tblLicenseTypeDef data contains:

1 , MotorCycle < 125,0,1,0
2 , MotorCycle > 125,0,2,0
3 , Car 1 ,0,0,1
4 , Car 2 ,0,1,1
5 , Car 3 ,0,2,1
5 , Car 4 ,0,3,1

tblCandidateLicense data contains

1 , 57, 1
2 , 57, 3
3 , 58, 4

I use the intRank to determine which vehicle is bigger and intRankParent to make groups (so motorbikes and cars searched don't bring back the wrong type)

I want to be able to search on License Type .



But now a person can search for car 4 and motorcyle > 125. Then my query needs to find all the people with car type 4 AND Smaller (car-1-2-3-4) (that is group 4), and motorcycle and smaller (1 and 2) (Group 0)

If a person search for car type Car 3 and motorcycle < 125, then car 1-2-3 and MotorCycle 1 must be returned.



I hope it makes sense.

View 5 Replies View Related

Rows Which Are Associated With Values Greater Than Specific Value

Jun 5, 2014

I am trying to select all the data which are not associated with values older than a specific value.. For example I have:

paola -- 2
paola -- 3
paola -- 10

jessica -- 3
jessica -- 12

james -- 3
james -- 2
james -- 5

I want to query only those names, that are associated with numbers greater than 3. So, for this example, the result would be only Jessica. the others should be discarded.

View 4 Replies View Related

COMPARING WITH COLUM WITH SPECIFIC VALUES IN SQL

Feb 6, 2008

Im Working with stored procedure. How can i compare Columns with specific values. I want to get the greater values of those column and inserted it to other columns. i want something like these
CASE
WHEN a> b,c,d THEN a
WHEN b> a,c,d THEN b
WHEN c> a,b,d THEN c
WHEN d> a,d,c THEN d

is there any ways to implement this? i got an error..
thanks please help..

View 7 Replies View Related

[effeciency] Specific Result Values

Apr 14, 2006

Hi.

I had no idea what to name the topic so I hope this is ok.



I feel like I am losing it, even though I am still learning SQL Server - I dont use it much in terms of technical/complex queries and so on but I do use SQL on a regular (almost) basis. I am all about making sure it is secure and effecient and performance and so on - just to give a bit of background about myself.

Say for instance I have an ASP.NET website, which I have developed a discussion board from scratch using SQL Server to store all the information.

Say for instance, we have a topic, and that topic will be "locked".

Would I be correct in saying that on such a table, "Topics", there should be a field which is known as "ActiveStatus" or "IsLocked", and depending on if the thread is locked or not, that value is set on the table field? Am I correct in saying this?

If not - then what is the correct way of stating/retrieving if the topic is locked, in other words, what is the best way to have control over the thread so you can lock the topic?

I cannot think of another way but to store this one value in SQL on this topic table, along with other fields. I would then get the result by calling the procedure from ASP.NET and accordingly, set an image button on the webpage to either "locked" or "post reply"



Sorry for being silly, but I want to confirm if I am about to do this correctly or not. I want to make sure I am doing the best practice all the time, and enjoy doing it naturally. What is the best design/decision on such a scenario/situation?

Many thanks for your input, I greatly appreciate it! :-)

View 3 Replies View Related

Extracting Specific Values From One Table And Insert Them Into Another

Jun 3, 2008

Hello. I have a somwhat simple question.
I have a table inside my database where i have some columns. Id like to extract distinct values from one column and inser them into another. My table is named article and id like to slect all the destinct values from the column naned type inside my article table. Then i need to insert my values into a new table called type but i would also like the to have 2 columns inside my type table. 1 called counter witch is an auto increment PK, and another one named type where the results from my query would be inserted.
Iv tried a veriety of querys but none of them have managed to do this.
Could anyone help me construct this query?

View 2 Replies View Related

T-SQL (SS2K8) :: Concatenate Specific Values From A Column

May 20, 2014

Give this data set;

declare @BO table (Col1 varchar(50), Col2 varchar(50))
insert into @BO values
('01','009920140516102116'),
('071710811019600001000005',''),
('070534524264000001000005',''),
('001806505517000001000005',''),

[Code] ....

select * from @BO

The 2 digit number that appears on line 1, 7 and 13 (only in this example) i need to have added to the begin of each value below it until the next 2 digit number is encountered. The desired result set would look like:

declare @BOD table (Col1 varchar(50), Col2 varchar(50), col3 varchar(50))
insert into @BOD values
('01','009920140516102116',''),
('071710811019600001000005','','01071710811019600001000005'),
('070534524264000001000005','','01070534524264000001000005'),

[Code] ....

View 7 Replies View Related

T-SQL (SS2K8) :: Search Through Rows With Specific Values

Sep 16, 2015

I've a table that stores operationcode for each jobnumber. The jobnumber can have multiple operationcode. From the below DDL, I need to show all the jobs that have operation codes as 2001 and 2002. In the below DDL Jobnumber 80011 has both the operation codes 2001 and 2002 so this job will display on the report.

On the other hand Job 80021 only has operationcode 2001 and I do not want this job to show up on the report.

I need to show all the operationcodes for a job if it has operationcode 2001 and 2002.

USE tempdb;
GO
DECLARE @TEST_DATA TABLE
(
DT_ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED
, OperationCodeVARCHAR(10) NOT NULL
, EmployeeCode VARCHAR(10) NOT NULL

[Code] ....

View 9 Replies View Related

Count Only Specific Comma Separated Values

Jan 5, 2015

I'd like to limit my query results to only items that match any part of a dynamic csv string table but am having some trouble (postgres SQL). Details: I need to calculate how many hours our staff spends seeing clients. Each staff has different appointments that can count toward this. The specified appointments for each staff are listed as comma separated values. My existing query calculates the appointment hours for each staff in a given time period.

However, I need limiting my query to only include specified activities for each staff. My current where clause uses IN to compare the appointment (i.e. activity) listed in the staff's schedule with what is listed an an approved appointment type (i.e. performance target activity). The query runs but it seems to only count one of the activities listed in the csv rather then count all the activities that match with the csv.

select (sum (kept)/60) from (select distinct rpt_scheduled_activities.staff_id as sid,
rpt_scheduled_activities.service_date, rpt_scheduled_activities.client_id,
from rpt_scheduled_activities inner join rpt_staff_performance_target on rpt_scheduled_activities.staff_id = rpt_staff_performance_target.staff_id where

[code]...

View 1 Replies View Related

Transact SQL :: Sequence Of Characters - Extract Some Specific Values

May 13, 2015

I've the following data:

<Hour>11</Hour><Hour>12</Hour><Hour>15</Hour><Hour>18</Hour>

And my goals is to the extract the following example:

11,12, 15, 18

How Can I do That?

View 6 Replies View Related

Need Help For Updating Values

May 14, 2008

Hi!

I am trying to retrieve and update data. I am retrieving the data into the respective controls such as textboxes. The codes are follow:

Retrieve data - working

Dim sqlConn As New SqlConnection()
sqlConn.ConnectionString = ConfigurationManager.ConnectionStrings("ScheduleConnectionString").ToString()

Dim com As SqlCommand = New SqlCommand("SELECT * FROM Demo_Theatre_DB WHERE ID=" & "@ID", sqlConn)

Dim paramID As New SqlParameter("@ID", SqlDbType.Int)

paramID.Direction = ParameterDirection.Input

com.Parameters.Add(paramID)
paramID.Value = e.Value
sqlConn.Open()
Dim reader As SqlDataReader = com.ExecuteReader()
While reader.Read()
StartTimeTextBox.Text = reader("StartTime")
EndTimeTextBox.Text = reader("EndTime")
CompanyNameTextBox.Text = reader("CompanyName")
PurposeTextBox.Text = reader("Purpose")
AccountManagerTextBox.Text = reader("AccountManager")
PresenterTextBox.Text = reader("Presenter")
ColorDDL.SelectedValue = reader("ColorCode")
StatusRadioButtonList.SelectedValue = reader("Status")
CommentTextBox.Text = reader("Comments")
End While


update the data - NOT WORKING


Dim sqlConn As New SqlConnection()
sqlConn.ConnectionString = ConfigurationManager.ConnectionStrings("ScheduleConnectionString").ToString()

Dim cmd As SqlCommand = New SqlCommand("UPDATE Demo_Theatre_DB SET StartTime = @StartTime, EndTime = @EndTime, CompanyName = @CompanyName, Purpose = @Purpose, AccountManager = @AccountManager, Presenter = @Presenter, ColorCode = @ColorCode, Status = @Status, Comments = @Comments WHERE ID=@ID")

cmd.Parameters.AddWithValue("StartTime", StartTimeTextBox.Text)
cmd.Parameters.AddWithValue("EndTime", EndTimeTextBox.Text)
cmd.Parameters.AddWithValue("CompanyName", CompanyNameTextBox.Text)
cmd.Parameters.AddWithValue("Purpose", PurposeTextBox.Text)
cmd.Parameters.AddWithValue("AccountManager", AccountManagerTextBox.Text)
cmd.Parameters.AddWithValue("Presenter", PresenterTextBox.Text)
cmd.Parameters.AddWithValue("ColorCode", ColorDDL.SelectedValue)
cmd.Parameters.AddWithValue("Status", StatusRadioButtonList.SelectedValue)
cmd.Parameters.AddWithValue("Comments", CommentTextBox.Text)

Try
sqlConn.Open()
cmd.ExecuteScalar()

Catch ex As Exception
InsertMsgLabel.Text = ex.ToString
End Try
End Sub


I am getting the following error whenever I click update button.
"ExecuteScalar: Connection property has not been initialized"

Your help will be appriciated!

Thanks!

View 24 Replies View Related

Transact SQL :: How To Convert Row Specific Values Into Columns In Join Query

Aug 18, 2015

I am using stored procedure to load gridview,i want to show row specific values in coloumns , as i an working on daily timetable of college and There are three tables Week_Day,Daily_Timetable & Subject.Daily_Timetable has data which has week_day,class_id,Subject_id,Period_No.

Each day has 6 periods and each period is mapped with subject in daily timetable.From below sql i am getting 6 rows of monday.

But i want to show in a row weekname,period1_subject_id(Period_No=1),period2_subject_id(Period_No=2),period3_subject_id.......upto
period6_subject_id.

Please see my query below:-

SELECT     Week_Day.Week_Day_name, Subject.Subject_Code,  Daily_Timetable.Period_No
FROM         Week_Day LEFT JOIN
                      Daily_Timetable ON Week_Day.Week_Day_Id = Daily_Timetable.Week_Day_Id and Daily_Timetable.Class_Id=6  LEFT JOIN
                      Subject ON Daily_Timetable.Subject_Id = Subject.Subject_Id order by  Week_Day.Week_Day_Id ,Daily_Timetable.Period_No

View 4 Replies View Related

Updating With Aggregate Values

Mar 9, 2004

I have table A which has and accountid,df_date1,df_date2. The table is a demographic one which has 1 record for each account
I have a table B which I need to populate from the first df_date1 fields in table A. Table B which is normalized and has an accountid and a df_date1 field but may have several records per accountid. I need the max(date) from this table. I wanted to do an update statement like below

update A
set df_date1
= max(df_date1) from b
where a.account_id = b.account_id

I get the error message
Server: Msg 157, Level 15, State 1, Line 3
An aggregate may not appear in the set list of an UPDATE statement.

Is there another way to do this with a subselect and update?

View 2 Replies View Related

Updating Null Values

Jun 23, 2008

how to use update statement to update fields in a table that has Null values

update sheet1 set [Middle Initial]='' where isnull([Middle Initial],'')=''
this statement some times works sometimes not.

View 7 Replies View Related

Updating Values In A Table

Nov 7, 2007

I have a table named 'Personal' that has a field that contains values that represent colors (ex: BLACK, BROWN, BLUE, etc.). How do I run an update statement to update the values to defined set. For example (BLACK = BLK, BLUE = BLU, etc.)?

Thanks

View 5 Replies View Related

Updating Several Values At The Same Time

Nov 16, 2007

Hi

I'm new to SQL and have a problem with the following script:-

INSERT INTO organisation_links (organisation_number_1, organisation_number_2, relationship, amended_on, amended_by)
VALUES 2311, 19219, 'BRAN', '01/12/2007', 'Jon')

The above script works OK on a one-off basis but....

Basically, organisation_number_2 (i.e. 19219) always stays the same. However, I need to update organisation_number_1 several times (i.e. 2311 will then change to 2312, 2313, 2314 etc.).

Rather than pasting the script several hundred times and changing the organisation_number_1 value each time, is there a quick way to encompass all the organisation_number_1 values in one go?

I've tried e.g. VALUES (2311,2312), 19219, 'BRAN' etc. but this doesn't seem to work.

Thanks for your help.

Jon

View 6 Replies View Related

Updating Duplicated Values

Feb 14, 2008



I have a table like that:


ColumnA ColumnB ColumnC
-------------------------------
Alice Lukas Alice.Lucas
James Redford James.Redford
James Redford James.Redford
Michael Jackson Michael.Jackson
John Brown John.Brown
John Brown John.Brown
John Brown John.Brown
George Gotham George.Gotham


I want to update duplicated values at ColumnC like:


Alice Lukas Alice.Lucas
James Redford James.Redford
James Redford James.Redford1
Michael Jackson Michael.Jackson
John Brown John.Brown
John Brown John.Brown1
John Brown John.Brown2
George Gotham George.Gotham


How can i do it?


Thanks in advance!


Note: Table is for creating email aliases from names...

View 2 Replies View Related

Updating The Values While Selecting

May 2, 2008

SELECT
#followups.suspectid,
#followups.planid,
cond4,
cond5,
cond6,
cond7,
cond8,
tbpdmmembers.firstname tbpdmmembers_firstname,
dbo.GetMemID_PartC_D(#followups.hic,#followups.IsPart_C) tbpdmmembers_MemberID,
--tbpdmmembers.Plan1 tbpdmmembers_MemberID,
tbaddress.address1 tbaddress_address1,
tbaddress.address2 tbaddress_address2,
tbaddress.city tbaddress_city,
tbaddress.state tbaddress_state,
tbaddress.zip tbaddress_zip

from #followups


I want to check if the tbaddress.address1 tbaddress_address1 if it is =null or empty then make it = tbaddress.address2 tbaddress_address2, at the same time I make the tbaddress.address2 tbaddress_address2, null. Otherwise leave it as it is.

Actually, I am working with the report and the tbaddress.address1 carrying the apt number. if there is no aprt # then the line print blanks. so that brings the empty line between the street address and the citystate line.
That is what i am tryig to cover. There could be a way to do this from the crystal report but I am thinking of doing this way cause I can't get the solution to do it from the crystal report.

View 5 Replies View Related

Updating A Table With Only Certain Values

May 16, 2008

Hello, I have been SSIS for a bit now, but really only it its most straight forward simple tasks I have the following issue which for the life of me I can't seem to sort out



1)Excel Source - - -> all data pushed into a initial SQL table

2) Data in initial SQL table gets sorted, certain fields get made UPPER , right trim that sort of thing

3) now I select a set of distinct values of a certain column in the SQL table and get a list of maybe 60 results

these results I want to enter into a table in a different database on same server, the table in the destination db has a identity column and a value column



adding / appending all the distinct value from the import data works fine,

but I want to add only the values which are not already in the destination table what is the best way to update the destination table, should I be using stored proc or is there a easier way in SSIS to do this



Thanks


View 1 Replies View Related







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