Invalid Column References Editor
Mar 19, 2008
Hi All,
I'm pretty new with SSIS. I have written some custom component which will read from flat file and write it into database. Between those processes, there are other processes which will analyse and transform the data being transfered. Everytime, I remove a column from upstream component, I have to go through each component to fix up column reference mapping using Invalid Column References Editor. There are lots of clicking involves just to remove a column from upstream component. My package has about 15 components. I am just wondering, is there anyway for us to prevent that editor to pop up, instead fixing invalid column reference programatically in ReInitializeMetadata?
Thanks,
Will
View 7 Replies
ADVERTISEMENT
May 15, 2008
Hey.
I'm trying to create some tables in my database but I'm getting some errors... The one which is causing the most trouble is Msg 1767, Level 16, State 0, Line 38
Foreign key 'ten_fk' references invalid table 'Tenant'.
I'm not sure why it's complaining... can anyone help me out here?
Cheers!
-- Mitch Curtis
-- A2create.sql
-- Set the active database to KWEA.
USE KWEA;
-- Drop existing tables (if any).
DROP TABLE Ownership;
DROP TABLE Tenant;
DROP TABLE Staff;
DROP TABLE Property;
DROP TABLE Property_Status_Report;
DROP TABLE Property_Owner;
DROP TABLE Placement_Record;
DROP TABLE Candidate_Tenant;
DROP TABLE Waiting_List;
-- Create new tables.
CREATE TABLE Waiting_List
(
waiting# INT IDENTITY(1,1) PRIMARY KEY NOT NULL,
candidate_name VARCHAR(20) NOT NULL,
anticipated_start_date SMALLDATETIME NULL,
anticipated_end_date SMALLDATETIME NULL,
max_affordable_rent SMALLMONEY NOT NULL
);
CREATE TABLE Candidate_Tenant
(
candidate# INT IDENTITY(1,1) PRIMARY KEY NOT NULL,
waiting# INT NULL,
name VARCHAR(20) NOT NULL,
phone_number INT NOT NULL,
required_property_type VARCHAR(10) NOT NULL,
CONSTRAINT w_fk FOREIGN KEY(waiting#) REFERENCES Waiting_List(waiting#)
);
CREATE TABLE Placement_Record
(
opening# INT IDENTITY(1,1) PRIMARY KEY NOT NULL,
tenant# INT NOT NULL,
start_date SMALLDATETIME NOT NULL,
end_date SMALLDATETIME NOT NULL,
total_bonds SMALLMONEY NOT NULL,
weekly_rent SMALLMONEY NOT NULL,
CONSTRAINT ten_fk FOREIGN KEY(tenant#) REFERENCES Tenant(tenant#)
);
CREATE TABLE Property_Owner
(
owner# INT IDENTITY(1,1) PRIMARY KEY NOT NULL,
name VARCHAR(20) NOT NULL,
phone_number INT NOT NULL
);
CREATE TABLE Property_Status_Report
(
address VARCHAR(30) NOT NULL,
report_date SMALLDATETIME NOT NULL,
weekly_rent SMALLMONEY NOT NULL,
month_rent_start_date SMALLDATETIME NOT NULL,
month_rent_end_date SMALLDATETIME NOT NULL,
maintenance_fee SMALLMONEY NOT NULL,
month_inspection_history VARCHAR(30) NULL,
CONSTRAINT ar_pk PRIMARY KEY(address, report_date),
FOREIGN KEY(address) REFERENCES Property(address)
);
CREATE TABLE Property
(
address VARCHAR(30) PRIMARY KEY NOT NULL,
staff# INT IDENTITY(1,1) NOT NULL,
type VARCHAR NOT NULL,
occupant_limit INT NOT NULL,
comments VARCHAR(30) NULL,
FOREIGN KEY(staff#) REFERENCES Staff(staff#)
);
CREATE TABLE Staff
(
staff# INT IDENTITY(1,1) PRIMARY KEY NOT NULL,
manager# INT NOT NULL,
name VARCHAR(20) NOT NULL,
FOREIGN KEY(manager#) REFERENCES Staff(staff#)
);
CREATE TABLE Tenant
(
tenant# INT IDENTITY(1,1) PRIMARY KEY NOT NULL,
staff# INT NOT NULL,
property_address VARCHAR(30) NOT NULL,
name VARCHAR(20) NOT NULL,
phone_number INT NOT NULL,
street VARCHAR(20) NOT NULL,
city VARCHAR(20) NOT NULL,
postcode INT NOT NULL,
category VARCHAR(10) NOT NULL,
comments VARCHAR(30) NULL,
FOREIGN KEY(staff#) REFERENCES Staff(staff#),
FOREIGN KEY(property_address) REFERENCES Property(address)
);
CREATE TABLE Ownership
(
address VARCHAR(30) NOT NULL,
owner# INT NOT NULL,
CONSTRAINT ao_pk PRIMARY KEY(address, owner#),
FOREIGN KEY(address) REFERENCES Property(address),
FOREIGN KEY(owner#) REFERENCES Property_Owner(owner#)
);
-- Display tables.
SELECT * FROM Waiting_List;
SELECT * FROM Candidate_Tenant;
SELECT * FROM Placement_Record;
SELECT * FROM Property_Owner;
SELECT * FROM Property_Status_Report;
SELECT * FROM Property;
SELECT * FROM Staff;
SELECT * FROM Tenant;
SELECT * FROM Ownership;
Errors:
Msg 3701, Level 11, State 5, Line 8
Cannot drop the table 'Ownership', because it does not exist or you do not have permission.
Msg 3701, Level 11, State 5, Line 9
Cannot drop the table 'Tenant', because it does not exist or you do not have permission.
Msg 3701, Level 11, State 5, Line 10
Cannot drop the table 'Staff', because it does not exist or you do not have permission.
Msg 3701, Level 11, State 5, Line 11
Cannot drop the table 'Property', because it does not exist or you do not have permission.
Msg 3701, Level 11, State 5, Line 12
Cannot drop the table 'Property_Status_Report', because it does not exist or you do not have permission.
Msg 3701, Level 11, State 5, Line 13
Cannot drop the table 'Property_Owner', because it does not exist or you do not have permission.
Msg 3701, Level 11, State 5, Line 14
Cannot drop the table 'Placement_Record', because it does not exist or you do not have permission.
Msg 1767, Level 16, State 0, Line 38
Foreign key 'ten_fk' references invalid table 'Tenant'.
Msg 1750, Level 16, State 0, Line 38
Could not create constraint. See previous errors.
View 4 Replies
View Related
May 30, 2006
Hi everyone,
When you've got -for example- a derived column task linked with a Flat file and then you change any field and come back to derived column task again you have select that field
with two possibilities:
1-€˜Leave as invalid column reference€™ /
2-€˜Delete invalid column reference€™
It€™s easy when just one is affected but when you have eight or ten is very tedious do the same one by one. Any way for to do same but selecting more than one?
Thanks for any input,
View 3 Replies
View Related
Oct 7, 2014
I got the following problem to solve in TSQL. I don't want to use a cursor. But with the set based solution I am stuck.
Here is my problem:
DECLARE @tmp TABLE (CustomerID INT, CustomerLink INT, PRIMARY KEY(CustomerID))
INSERT @tmp
VALUES(100001,0)
,(100002,100001)
,(100003,100001)
,(100004,100003)
,(100005,100006)
[Code] ....
Desired result:
[CustomerID of a group member],[smallest CustomerID per Group]
|(GroupID)|CustomerID|CustomerLink|
|100001 |100001 |100001 |
|100001 |100002 |100001 |
|100001 |100003 |100001 |
|100001 |100004 |100001 |
|100005 |100005 |100005 |
[Code] .....
doesn't work for crossreferences :.(
RESULTSET:
CustomerID CustomerLink
100001 100001
100002 100001
100003 100001
100004 100001
100005 100005
100006 100006 --wrong
[Code] .....
View 9 Replies
View Related
Jul 20, 2005
I have a task to where I need to move a column from one table toanother. I want to be sure I update any view, stored procedure,trigger, etc. that references the column. I simply want a query thatwill report the related objects and then I will update them manuallybut before I go and try and figure out how to do this by querying thesys tables is there an sp_sproc that will do this?
View 1 Replies
View Related
May 8, 2008
Greetings, I am attempting to create a flat file delimited by |. I am using (ISNULL(LIN1_OPT_ADDR) ? "" : LIN1_OPT_ADDR + "| ") to replace the blank address column with the pipe delimiter. So that a row that would consist of:
Customer Number,Name,Address Line1,City,State
12345,ACE HARDWARE INC. ,801 Rockefeller St.,New York, New York
56789,BUILDING SUPPLY INC., ,Wichita, Kansas
Should end up as:
12345|ACE HARDWARE INC.|801 Rockefeller St.|NEW YORK|NEW YORK
56789|BUILDING SUPPLY INC.||Wichita|Kansas
When I run the data flow to create the flat file the file contains the following:
12345|ACE HARDWARE INC.|801 Rockefeller St.|NEW YORK|NEW YORK
56789|BUILDING SUPPLY INC.| | |Wichita|Kansas
Can anyone tell me what I am doing wrong?
Thanks.
View 3 Replies
View Related
Dec 7, 2006
I am working on a situation similar to 'Get all from Table A that isn't in Table B' http://www.sqlis.com/default.aspx?311
I noticed that if one column's name of source table changes,(say Year to Year2) I have to modify all 'data flow transformations' in the task.
I am new to SSIS.
thanks! -ZZ
View 8 Replies
View Related
Feb 8, 2008
I need to check if the date is Null then use today's date and if not do something else.
If RowModifiedOn IS NULL Then
GETUTCDATE()
ELSE
DATEADD("Hh",@[User::TimeZone],RowModifiedOn)
End If
What do I do wrong here? Can I do something like it?
RowModifiedOn == NULL ? GETUTCDATE() : DATEADD("Hh",@[User::TimeZone],RowModifiedOn)
Thanks.
View 1 Replies
View Related
Mar 28, 2008
The "window" if you call it that to enter in complex derived column logic is painful (at best). At a minimum, the entry line should (just like in the cases where SQL is entered into a ole db command, sql exec etc) open a editor window to allow you to work in something other than a single long line.
In addition, allowing for cr/lf in the text would then allow the text to be formated/indented in meaninful ways. The issue now, once you nest a few statements together, it get VERY confusing and not easy to read since the whole thing is required to be on a single line.
(This same issue exists with line in which you need to enter the text in a conditional split).
THANKS!
View 4 Replies
View Related
Aug 30, 2006
Help...
I'm having trouble coming up with a valid expression in my derived column transformation editor that tests the input column for NULL and responds something like this:
if[message] isNull then "NA" else [message]
where [message] is the input column.
Thanks!
View 1 Replies
View Related
Aug 30, 2006
Help...
I'm having trouble coming up with a valid expression in my derived column transformation editor that tests the input column for NULL and responds something like this:
if[message] isNull then "NA" else [message]
where [message] is the input column.
Thanks!
View 3 Replies
View Related
Aug 23, 2007
I am trying to put the following as an expression in the SSIS Derived Column Transformation Editor.
DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()), 0)
It is not allowing it. This works fine in a regular SQL statement.
Does anyone know how I can get this to work?
View 14 Replies
View Related
Mar 28, 2007
Dear friends, can any one tell me how to assign null to the expression value in derived column transfromation editor?
thanks,
View 5 Replies
View Related
Sep 4, 2007
This one has set me back many, many hours on this project; it's about got me ready to dump SSIS & just roll a custom .NET solution in C#.
I need to create import packages for quite a few very wide flat files (130 - 180+ columns, not my design). Many of these columns have data > 50 characters long.
I change column widths on the data flow source using the Advanced Editor, via Input and Output Properties ==> Flat File Source Output ==> External Columns.
About 50% of the time, the changes vanish after clicking OK to dismiss the Advanced Editor. There is no warning message or output announcing that the editor failed to persist its changes, or that it set some columns' properties back to the defaults, or why. The column's widths just silently revert back to 50.
If the cause and resolution aren't known, does anyone know of a way to accomplish any of the following workarounds?
Create a data source connection by importing an external text schema defining the flat file's column names, data types and sizes, or
Change a property on multiple source columns en-masse, or...
Get at a text version of the file containing the Data Flow Component's definition, so we can edit wide import schemas without racking up thousands of mouse-clicks?Thanks! A virtual cheeseburger to anyone with answers.
View 7 Replies
View Related
May 15, 2008
I want to replace the contents of a value column with itself but rounded to 2 decimal places.
The current column is a double and I have tried to perform this using the following expression but it fails to work.
Code Snippet
Round(cc_vl,2)
How should I achieve this?
View 7 Replies
View Related
Jan 15, 2008
ALTER procedure [dbo].[MyPro](@StartRowIndex int,@MaximumRows int)
As
Begin
Declare @Sel Nvarchar(2000)set @Sel=N'Select *,Row_number() over(order by myId) as ROWNUM from MyFirstTable Where ROWNUM
Between ' + convert(nvarchar(15),@StartRowIndex) + ' and ('+ convert(nvarchar(15),@StartRowIndex) + '+' + convert(nvarchar(15),@MaximumRows) + ')-1'
print @Sel
Exec Sp_executesql @Sel
End
--Execute Mypro 1,4 --->>Here I Executed
Error
Select *,Row_number() over(order by myId) as ROWNUM from MyFirstTable Where ROWNUM
Between 1 and (1+4)-1
Msg 207, Level 16, State 1, Line 1
Invalid column name 'ROWNUM'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'ROWNUM
Procedure successfully created but giving error while Excuting'.
Please anybody give reply
Thanks
View 2 Replies
View Related
May 12, 2007
Hi
I'm a relative SQL Server newbee and have developed a function that converts mm/dd/yyyy to yyy/mm/dd for use as in a DT_DBDATE format for insert into a column with smalldatatime.
I receive the following erros when using the function in the Derived Column Transformation Editor. First, the function, then the error when using it as the expression Derived Column Transformation Editor.
Can anyone explain how I can do this transformation work in this context or suggest a way either do the transformation easier or avoid it altogerher?
Thanks for the look see...
******************************
ALTER FUNCTION [dbo].[convdate]
(
@indate nvarchar(10)
)
RETURNS nvarchar(10)
AS
BEGIN
-- Declare the return variable here
DECLARE @outdate nvarchar(10)
set @outdate =
substring(@indate,patindex('%[1,2][0-9][0-9][0-9]%',@indate),4)+'/'+
substring(@indate,patindex('%[-,1][0-9][/]%',@indate),2)+'/'+
substring(@indate,patindex('%[2,3][0,1,8,9][/]%',@indate),2)
RETURN @outdate
END
********************************
And the error...
expression "lipper.dbo.convdate(eomdate)" failed. The token "." at line number "1", character number "11" was not recognized. The expression cannot be parsed because it contains invalid elements at the location specified.
Error at Data Flow Task [Derived Column [111]]: Cannot parse the expression "lipper.dbo.convdate(eomdate)". The expression was not valid, or there is an out-of-memory error.
Error at Data Flow Task [Derived Column [111]]: The expression "lipper.dbo.convdate(eomdate)" on "input column "eomdate" (165)" is not valid.
Error at Data Flow Task [Derived Column [111]]: Failed to set property "Expression" on "input column "eomdate" (165)".
(Microsoft Visual Studio)
===================================
Exception from HRESULT: 0xC0204006 (Microsoft.SqlServer.DTSPipelineWrap)
------------------------------
Program Location:
at Microsoft.SqlServer.Dts.Pipeline.Wrapper.CManagedComponentWrapperClass.SetInputColumnProperty(Int32 lInputID, Int32 lInputColumnID, String PropertyName, Object vValue)
at Microsoft.DataTransformationServices.Design.DtsDerivedColumnComponentUI.SaveColumns(ColumnInfo[] colNames, String[] inputColumnNames, String[] expressions, String[] dataTypes, String[] lengths, String[] precisions, String[] scales, String[] codePages)
at Microsoft.DataTransformationServices.Design.DtsDerivedColumnFrameForm.SaveAll()
View 3 Replies
View Related
Apr 3, 2008
Hi,
Is there a way of uploading column definitions from the Flat File Connection Manager into a SQL Server table definition. Since I have over a dozen data sources to process each with around 200 columns and of course like many BI techies I have little immediate influence over the structure of these flat files. I just know that these data sources are business critical.
Judging by looking at similar threads I can't be the only one who would greatly benefit from being able to upload column definitions from the Flat File Connection Manager into a SQL Server table definition as opposed to doing this manually.
Thanks in advance,
Kieran.
View 1 Replies
View Related
Mar 19, 2004
I get a Invalid Column Name ' '. with this procedure. Can anyone see what migh be wrong?
Thanks,
SELECT A.CompanyName,C.FirstName,C.LastName,C.Client_ID,
CASE WHEN A.[CompanyName] IS NULL OR A.[CompanyName] = '' THEN C.[FirstName] +" "+ C.[LastName] ELSE A.[CompanyName] END AS DRName, C.Client_ID
FROM tblClients C INNER JOIN tblClientAddresses A ON C.Client_ID = A.Client_ID
WHERE (C.Client_ID = 15057) AND (A.MailTo=1) AND Convert(varchar(5), GETDATE(), 10) BETWEEN Convert(varchar(5), A.Startdate, 10) AND Convert(varchar(5), A.Enddate, 10) OR (A.Startdate Is Null) AND (A.EndDate Is Null)
GO
View 3 Replies
View Related
Aug 19, 2004
Hi the following SP that causes an error.
CREATE PROCEDURE GetInfo
(
@MinPriceint=0,
@MaxPriceint=9999999999,
@TypeHomenvarchar(50)=NULL,
@Locationnvarchar(100)=NULL
)
AS
Declare @strSql nvarchar(255)
Set @strSql="Select * from table WHERE "
Set @strSql=@strSql + 'Price BETWEEN ' + CONVERT(nvarchar(20),@MinPrice) + ' and ' + CONVERT(nvarchar(20),@MaxPrice )
If @TypeHome != "No Preference"
Set @strSql=@strSql + ' and Type = ''' + @TypeHome+ ''''
If @Location != "No Preference"
Set @strSql=@strSql + ' and City = ''' + @Location+ ''''
Set @strSql=@strSql + ' and IDX = ''Y'' ORDER BY Price'
Exec(@strSql)
GO
The Error I get is:
"Error 207: Invalide Column Name 'Select * from table WHERE'
Invalid Column Name 'No Preference'
Invalid Column Name 'No Preference'
I have checked the table and the columns do exist, spelled correctly and caps are all the same. Also, this same SP in another table works just fine.
What is causing this error?
Thanks in advance!
View 1 Replies
View Related
Feb 16, 2001
Can anyone tell me why I get the above message using the following stored procedure and passing in a value of 120:
CREATE Procedure qryAnalysisCountMain
(@WizardGroup1Question int)
As
EXEC("SELECT QuestionDescription FROM Questions WHERE QuestionCode = " + @WizardGroup1Question)
120 just happens to be the asci value of 'x' and whatever number I pass in gets converted into it's character equivalent and the sp tells me it can't find that column name. QuestionCode is an int field so there is no problem there
The procedure works OK with:
SELECT QuestionDescription FROM Questions WHERE QuestionCode = @WizardGroup1Question
However I need the SQL in an EXEC as the sp will eventually be dynamic so that i can pass in the name of the table to select from.
Thanks
Martin
View 1 Replies
View Related
Mar 30, 2004
Hi
I have a dynamic select statement which is showed below.
declare @query varchar(100)
set @query = 'select * from undergraduate where Gender =' + @Gender
exec (@query)
//
When I execute the @query, I get an error message like "Invalid Column Name Male".
I think I need to put a single quotation around the dynamic variable, so that I have
select * from undergraduate where Gender ='Male'. But I am not sure how to do that.
Thank you for your help!!
View 3 Replies
View Related
May 6, 2008
Hello All,
I m facing problem in one query. What I did is
SELECT
PRODUCT_ID,
PRODUCT_END_DATE,
CASE
WHEN PRODUCT_ID = 1 THEN DATEADD(YY,-5,PRODUCT_END_DATE)
WHEN PRODUCT_ID = 2 THEN DATEADD(YY,-10,PRODUCT_END_DATE)
WHEN PRODUCT_ID = 3 THEN DATEADD(YY,-15,PRODUCT_END_DATE)
END AS MODIFIED_END_DATE
FROM PRODUCTS
WHERE MODIFIED_END_DATE BETWEEN '2008-04-01' AND '2008-04-30'
when I execute this query returns an error as
Invalid column name MODIFIED_END_DATE
So how can I write this query? any idea.
Thanks in advance.
--kneel
View 3 Replies
View Related
Jun 16, 2008
I have my column names right but its telling me they are invalid. It must be something to do with how I have my subquery formatted but I don't see it. I was wondering if anyone else can see it? It tells me payer_id is not right and I know its coming from the bolded section. I just added that line to do some additional grouping. I know that the query above aliased as D was working before I put the bolded line in. Am I setting this up wrong?
select distinct c.description,tmp.person_id,tmp.person_nbr,tmp.first_name,
tmp.last_name,tmp.date_of_birth,d.payer_name,b.create_timestamp
from PersonMIA tmp
join person a on a.person_id = tmp.person_id
join patient_encounter b on a.person_id = b.person_id
join provider_mstr c on b.rendering_provider_id = c.provider_id
cross apply(select top 1 payer_name
from person_payer
where person_id = tmp.person_id
order by payer_id) d
join payer_mstr e on d.payer_id = e.payer_id
join mstr_lists f on e.financial_class = f.mstr_list_item_id
where c.description = 'Leon MD, Enrique'
group by c.description,tmp.person_id,tmp.person_nbr,tmp.first_name,tmp.last_name,
tmp.date_of_birth,d.payer_name,b.create_timestamp
)tmp2
where year(create_timestamp) IN (2005,2006)
group by person_nbr,payer_name,first_name,last_name,description,create_timestamp
Thanks in Advance!
Sherri
View 2 Replies
View Related
Mar 26, 2006
I am building a query and thought I had completed it but I get 'Invalid Column Name "A1" when I run it?
SELECT
Groups.GroupID,
Sum(Stages_On_Route.Distance) AS Miles_Covered,
Groups.Group_Name
FROM Groups
INNER JOIN ((Route INNER JOIN Departure ON (Route.GroupID=Departure.GroupID)
AND (Route.RouteID=Departure.RouteID))
INNER JOIN Stages_On_Route ON Route.RouteID=Stages_On_Route.RouteID)
ON Groups.GroupID=Departure.GroupID
GROUP BY Groups.GroupID,
Groups.Group_Name
HAVING (((Groups.GroupID)="A1"));
View 6 Replies
View Related
Dec 4, 2007
Hi I'm new to this forum and I seem to be having a basic problem. I have moved from using MS Access to SQL Server and I seem to be having problem with the SQL below.
SELECT Table_A.*, (Statement_A) AS Value_A ,
(Value_A + 4) AS Value_B
FROM Table_A
I keep on getting an error stating invalid column name, I know that statement A is fine because when I move the calculation into Value_B it works.
Can anyone tell me what I am doing wrong?
View 4 Replies
View Related
Jul 20, 2005
When I try to add the line . . .CPM * MOU AS COST,after all the CASE lines I get the response in SQL Query Analyser,Server: Msg 207, Level 16, State 3, Line 1Invalid column name 'CPM'.Is it because I can not do this on this particular query since CPM isyet to be defined or do I just need to rephrase the request anotherway?The query now looks like this. . .SELECT DISTINCTDATA.dbo.[2004_JANUARY_SUM].RATEKEY,DATA.dbo.[2004_JANUARY_SUM].[DATE],DATA.dbo.[2004_JANUARY_SUM].CXRKEY,DATA.dbo.[2004_JANUARY_SUM].Area,DATA.dbo.[2004_JANUARY_SUM].Region,DATA.dbo.[2004_JANUARY_SUM].Market,DATA.dbo.[2004_JANUARY_SUM].AKA,DATA.dbo.[2004_JANUARY_SUM].MARS_NAME,DATA.dbo.[2004_JANUARY_SUM].O_MTA,DATA.dbo.[2004_JANUARY_SUM].O_MTA_NAME,DATA.dbo.[2004_JANUARY_SUM].O_STATE,DATA.dbo.[2004_JANUARY_SUM].O_LATA,DATA.dbo.[2004_JANUARY_SUM].O_LATA_NAME,DATA.dbo.[2004_JANUARY_SUM].MSC_CLLI,DATA.dbo.[2004_JANUARY_SUM].Trunk,DATA.dbo.[2004_JANUARY_SUM].Carrier,DATA.dbo.[2004_JANUARY_SUM].NPA_NXX,DATA.dbo.[2004_JANUARY_SUM].CALLS,DATA.dbo.[2004_JANUARY_SUM].MOU,DATA.dbo.[2004_JANUARY_SUM].TANDEM,DATA.dbo.[2004_JANUARY_SUM].T_MTA,DATA.dbo.[2004_JANUARY_SUM].T_MTA_NAME,DATA.dbo.[2004_JANUARY_SUM].T_STATE,DATA.dbo.[2004_JANUARY_SUM].T_LATA,DATA.dbo.[2004_JANUARY_SUM].[RC ABBRE],DATA.dbo.[2004_JANUARY_SUM].RC_ID,DATA.dbo.[2004_JANUARY_SUM].SWITCH,DATA.dbo.[2004_JANUARY_SUM].[OCN],DATA.dbo.[2004_JANUARY_SUM].[OCN_NAME],DATA.dbo.[2004_JANUARY_SUM].[CATEGORY],CASE WHEN SUBSTRING(DATA.dbo.[2004_JANUARY_SUM].[MSC_CLLI], 5, 2) =DATA.dbo.[2004_JANUARY_SUM].[T_STATE] THEN(CASE WHEN DATA.dbo.[2004_JANUARY_SUM].[CARRIER] = 'VENDOR4' THENTELECOM.DBO.DOMESTIC_LD_RATES2.INTRA_GXWHEN DATA.dbo.[2004_JANUARY_SUM].[CARRIER] = 'VENDOR3' THENTELECOM.DBO.DOMESTIC_LD_RATES2.INTRA_VENDOR3WHEN DATA.dbo.[2004_JANUARY_SUM].[CARRIER] = 'VENDOR2' THENTELECOM.DBO.DOMESTIC_LD_RATES2.INTRA_VENDOR2WHEN DATA.dbo.[2004_JANUARY_SUM].[CARRIER] = 'VENDOR1' THENTELECOM.DBO.DOMESTIC_LD_RATES2.[INTRA_VENDOR1]ELSE TELECOM.DBO.DOMESTIC_LD_RATES2.INTRA_TANDEMEND)ELSE(CASE WHEN DATA.dbo.[2004_JANUARY_SUM].[CARRIER] = 'VENDOR4' THENTELECOM.DBO.DOMESTIC_LD_RATES2.INTER_GXWHEN DATA.dbo.[2004_JANUARY_SUM].[CARRIER] = 'VENDOR3' THENTELECOM.DBO.DOMESTIC_LD_RATES2.INTER_VENDOR3WHEN DATA.dbo.[2004_JANUARY_SUM].[CARRIER] = 'VENDOR2' THENTELECOM.DBO.DOMESTIC_LD_RATES2.INTER_VENDOR2WHEN DATA.dbo.[2004_JANUARY_SUM].[CARRIER] = 'VENDOR1' THENTELECOM.DBO.DOMESTIC_LD_RATES2.[INTER_VENDOR1]ELSE TELECOM.DBO.DOMESTIC_LD_RATES2.INTER_TANDEMEND)END AS CPM,CPM * MOU as [COST]INTO TEST.dbo.[2004_JANUARY_RATES]FROM DATA.dbo.[2004_JANUARY_SUM] LEFT OUTER JOINTELECOM.dbo.DOMESTIC_LD_RATES2 ONDATA.dbo.[2004_JANUARY_SUM].RATEKEY =TELECOM.dbo.DOMESTIC_LD_RATES2.RATEKEYORDER BY DATA.dbo.[2004_JANUARY_SUM].[T_LATA] DESCOPTION (MAXDOP 2)
View 1 Replies
View Related
May 9, 2008
Is there not a way to perform a calculation on a column comprised from a Case Function?
This is my query:
SELECT
'ComparativeValue' =
CASE
WHEN Id = 1 THEN Index
WHEN Id = 2 THEN Peers
WHEN Id = 3 THEN PrevYear
END,
Variance = (Base - ComparativeValue)/ComparativeValue
FROM Table
I get this error when trying to execute the query:
Invalid column name 'ComparativeValue'.
View 7 Replies
View Related
Aug 25, 2006
Below is the T-SQL
SELECT ci.name,
ci.address,
CASE ISNULL(cci.geography,'')
WHEN 'P' THEN 'port'
WHEN 'A' THEN 'appt'
WHEN 'X' THEN 'xatt'
ELSE ''
END AS Link,
ci.InsuranceType
FROM dbo.Insurance ci
INNER JOIN dbo.Contract cci
ON ci.InsuranceId = cci.InsuranceId
AND cci.ContractId = 1266
ORDER BY
ci.Link,
ci.InsuranceType
===========================
My work environment is all in SQL SERVER 2005.
I have a problem with above T-SQL. There is an error while I run above code in Develoment Server.The error disappears when I put 'ci.Link' as 'Link' in OrderBy clause. My work environment has TEST, PRE-PRODUCTION and PRODUCTION. In all other environments the code runs fine with ci.Link but only in DEVELOPMENT the error persists. It has an error as 'Link is invalid column name'.
View 6 Replies
View Related
Nov 7, 2007
I need to identify where this column could be, I have checked in the syscolumns but did not find it as a result I am now having to manually check each view and sp that could use the column so I can transfer the database to my new SQL 2005 machine.
Is there an easier way to identify this coloumn by some sort of search??
View 6 Replies
View Related
May 16, 2008
Hi,
Can I write parameter name like shown below?
Code Snippet
SELECT 'N' AS LiquidatingFlag, Report, RptSection, Portfolio, RepExcRsn, Units,
FROM Exc_SummaryData_Custom
WHERE (Report IN (@Report)) AND (Portfolio IN (@Portfolio)) AND ( LiquidatingFlag IN(@LiquidatingFlag))
UNION ALL
SELECT 'R' AS LiquidatingFlag, Report, RptSection, Portfolio, RepExcRsn, Units,
FROM Exc_SummaryData_Custom_LIQ
WHERE ( Report IN (@Report)) AND (Portfolio IN (@Portfolio)) AND ( LiquidatingFlag IN (@LiquidatingFlag))
I get a error message saying invalid column name LiquidatingFalg.
(Actually there is no clumn in the original table)Can any one help to work this correctly?
View 5 Replies
View Related
Nov 15, 2007
Hi I have the following problem. I am trying to get some data from a database which matches the name in a session from a previous page:e.g. SqlCommand menubar = new SqlCommand("Select pernme from Person where pernme = " + (string)Session["tbname"], sqlConn); SqlDataAdapter dataAdapter5 = new SqlDataAdapter(); dataAdapter5.SelectCommand = menubar; DataSet dataSet5 = new DataSet(); dataAdapter5.Fill(dataSet5); DataTable selcartest4 = dataSet5.Tables["table"]; if (selcartest4.Rows.Count != 0)The session is called tbname and in that session is a users name however insetad of doing the nornal thing and retrieving the data in the sql database table matching that name it comes up with the following error message:System.Data.SqlClient.SqlException: Invalid column name 'jamie'this is weird as the 'jamie' is the name in the session from the previous page and in fact not a column name at all the column name is pernme I am totally stuck any help would eb great thanksJ
View 2 Replies
View Related
Dec 19, 2007
When i try to execute i receive following error:
Msg 207, Level 16, State 1, Procedure WedstrijdDeelnemersSelectAllMPNietGoedgekeurd, Line 85
Invalid column name 'Ploeg'.
I dont really see whats wrong with the select... it works fine in the 2 first parts of the querryALTER PROCEDURE [dbo].[WedstrijdDeelnemersSelectAllMPNietGoedgekeurd]
-- Add the parameters for the stored procedure here
@WedstrijdID int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
...
UNION
SELECT
dbo.fncGetPersoonNaam(L.PersoonID,0) as Persoon,
'Ploeg: ' + WDPI.Ploeg as TypeInschrijving,
WDPIL.LidClubID,
WT.Omschrijving as WedstrijdType,
C.Omschrijving as Categorie,
WDC.WedstrijdDetailID,
WDC.ID as WedstrijdDetailCategorieID,
WDPI.ID as TypeInschrijvingID
FROM
Wedstrijd W
INNER JOIN WedstrijdDetail WD ON W.ID = WD.WedstrijdID
INNER JOIN WedstrijdType WT ON WD.WedstrijdTypeID = WT.ID
INNER JOIN WedstrijdDetailCategorie WDC ON WD.ID = WDC.WedstrijdDetailID
INNER JOIN Categorie C ON WDC.CategorieID = C.ID
INNER JOIN WedstrijdDetailPloegInschrijving WDPI ON WDC.ID = WDPI.WedstrijdDetailCategorieID
INNER JOIN WedstrijdDetailPloegInschrijvingLid WDPIL ON WDPIL.WedstrijdDetailPloegInschrijvingID = WDPI.ID
...END
View 1 Replies
View Related