Invalid Column Name Total Counter

Jan 23, 2015

Error Message "invalid column name on total_counter ". How to edit this query and make it work ?

SELECT salesman_code,user_group,user_name,trx_acc_amt,trx_date,trx_no,sh_code,
salesman_code4,salesman_code5,salesman_code6,
Sum(case when salesman_code4 is null then 0 else 1 end +
case when salesman_code5 is null then 0 else 1 end +
case when salesman_code6 is null then 0 else 1 end) as total_counter,

[code]...

View 5 Replies


ADVERTISEMENT

Integration Services :: Cannot Load Counter Name Data Because Invalid Index Was Read From Registry

Aug 12, 2015

SSIS script task fail with error message-SSIS script task fail error message Error: Cannot load Counter Name data because an invalid index '' was read from the registry.

View 2 Replies View Related

Reset Identity Column Counter.

Aug 6, 2007

Is there a way to delete all items from a table that has an identity column and to reset the counter for all new insertions so that they begin at '1' again?

View 5 Replies View Related

Counter For Max Tickets - Refer To A Database Table Row/column Etc

Feb 7, 2008

I posted a thread in the Getting Started forum about how to make a counter for maximum tickets : http://forums.asp.net/t/1215258.aspx
but maybe this is a more appropriate forum for this subject.
In a school project, we are making a website for a fictional concert/festival (using Visual Studio 2005, C#). On that site users can register and order tickets.
We have access to an SQL-database, by the way, where we can create tables etc. 
We want the maximum amount of tickets to be 10000 per day. The festival is supposed to last from friday to sunday.
What would be the best way to do this programatically? The counter should maybe be in an own database table?

View 3 Replies View Related

Transact SQL :: How To Generate Rows Certain Times With A Counter Column

Jul 10, 2015

How can I write it in SQL? I have a table  that column  A   has two values of   Product  and Cost...Where value of A is Product, I have to add 6 more rows, and add column b with values from 1 to 7 for each rows ( counter)Where value of A is Cost, I have to add 4  more rows, and add column b with values from 1 to 5 for each rows ( counter).

View 3 Replies View Related

Power Pivot :: How To Create Incrementing Sub Counter For (sort By Column) Purposes

Nov 16, 2015

I have a table ComponentPeriod. In it we have the combination of a component (e.g. A,B,C ) and a period (2014 Q1, 2014 Q2, 2014 January etc)I want the periods to be in descending order (2015 Q4, 2015 Dec, 2015 Nov, 2015 Oct, 2015 Q3 ... etc) and so I need to create a sequential number series to allow this to happen (as we can only order in the client tools by a single column - and so I guess the technique I'm looking for is used a lot to produce these types of "order by" columns)

I have done this in the past using

Period_Sequence =
calculate
(countrows(Period)
,filter
(Period
, Period[Start_Date] <= earlier(Period[Start_Date])
&& Period[Duration_String] = earlier(Period[Duration_String])
)
)

Which was fine when I was referring to a table where Periods where distinct directly but now I have denormalised this for ComponentPeriod so I need something a little more sophisticated Whats the best way to get a sequence with perhaps some partitions in across a subset of distinct columns (I guess from SUMMARIZE or similar)

E.g. I want

Period_Name, Type, Sequence
2015 Q4, Quarter, 1
2015 Dec, Month, 2
2015 Nov, Month, 3
2015 Oct, Month, 4
2015 Q3, Quarter, 5
2015 Sep, Month, 6
etc

even though there may be multiple records in ComponentPeriod that have the period 2015 Q4, but I want them all to have the value Sequence value of 1? I've got as far as:

Period_Sequence Desc =
calculate
(countrows(summarize(ComponentPeriod, ComponentPeriod[Period_End_Date]))
,filter
( ComponentPeriod
, ComponentPeriod[Period_End_Date] >= earlier(ComponentPeriod[Period_End_Date])
)
)

But this doesn't distinguish between the different types. I need an equivalent of the t-sql -

row_number() over (order by Period_End_Date desc, case when 'P3M' then 1 when 'P1M' then 2 end asc

View 7 Replies View Related

Error Invalid Column Name (In Sqlserver 2005) While Giving Alias Column Name

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

Sum A Column And Get A Total

Oct 13, 2006

I have a Monthlyexpense column. How do I Sum up this column and put the Total in my ytdexpenses column. I think I figure out the query, but I don't know where to write the query at. Please help.

View 3 Replies View Related

Adding A Total Column

Jun 6, 2006

I have been working on a website in asp.net1.1 in vb.net2003.  I am using a sql2000 server.  I am attempting to add a column to my datagrid that will add the total number of wins and output the number in that colum.  With some help, I have been able to write the code. However, I am not sure where to put it. Is it a sql function I need to call from my code to add to the win column?  Thanks for your help.

View 1 Replies View Related

Adding A Total Column

May 16, 2002

This is a very simple select but I would like to add a final column that adds the QOH, QOB, QOO and Quantity. How can I accomplish this? Thanks
SELECT DISTINCT
zcus_MM_Medsurg_Used.stock_no,
zcus_MM_Medsurg_QOH_Only.qty_on_hand AS QOH,
zcus_MM_Medsurg_Used.QOB,
zcus_MM_Medsurg_Used.QOO,
zcus_MM_Medsurg_Used.QUANTITY

FROM
zcus_MM_Medsurg_QOH_Only INNER JOIN
zcus_MM_Medsurg_Used ON
zcus_MM_Medsurg_QOH_Only.stock_no = zcus_MM_Medsurg_Used.stock_no

View 1 Replies View Related

How To Calculate Only Total One Column

Jul 18, 2014

I want calculate to my total column sum

ex- col 1 col 2 col 3 col 4
raj 10 20 20
pani 20 88 88
tiger 87 78 89
john 77 77 77
---------
??
----------

View 1 Replies View Related

Transact SQL :: How To Get Total Value As A Column

Jul 14, 2015

I have a table like below, which is  contain area, zone, branch wise value. In that i want to get company total as a column and area total as a another column and zone total in next column

AREAZONEBRANCHVALUE
TNCENTRALAMB100
TNCENTRALTNF100
TNCENTRALSDGD100
TNCENTRALERW100
TNNORTHAMB50

[Code] ....

My expected output is like below

AREAZONEBRANCHVAL comtot areatot zonetot
TNCENTRALAMB1001200560400
TNCENTRALTNF1001200560400
TNCENTRALSDGD1001200560400

[Code] ...

I achieved this by using query but its will affect performance because my real time scenario dealing with laks of records

select a.*,b.company_tot,c.area_tot,d.zone_tot from FESIBILITY_CHECK a cross join (select SUM(value)company_tot from FESIBILITY_CHECK )b
join (select SUM(value)area_tot,area from FESIBILITY_CHECK group by area)c on a.AREA = c.area
join (select SUM(value)zone_tot,area,zone from FESIBILITY_CHECK group by area,zone)d on a.AREA=d.area and a.ZONE = d.ZONE

So I planned to use cube and roll up but i don't get desired result ...

View 8 Replies View Related

Max Column Total In SQL Server 2005

Dec 3, 2007

Hello,
Is there a maximum total of columns that SQL Server 2005 limits?  I have a rather lengthy import file in regards to column count, and was wondering if there was a total number of columns that a table is limited to.
Thanks.

View 3 Replies View Related

Update Column With Percentage Of Total For Each Row

Dec 9, 2011

I'm trying to work out the value of a item as a % of the group.Using my simplified table below (table called sweetie)

Date Name Sweets
01/11/2011Pete5
01/11/2011Paul10
01/11/2011Paddy15
02/11/2011Pete2
02/11/2011Paul4
02/11/2011Paddy6

I would like to select a column called PERC, which would be the sum of Sweets/sum of Sweets(grouped by date).So for example for the first value I would have 5/(5+10+15).I can write the query so it totals all the sweets, but I want to use totals by date and am unsure how I would do this..My query so far is (but this doesn't use totals by date)

Date NameSweetsPERC
01/11/2011Pete5 0.12
01/11/2011Paul10 0.24
01/11/2011Paddy15 0.36
02/11/2011Pete2 0.05
02/11/2011Paul4 0.10
02/11/2011Paddy6 0.14

How can I get it to calculate based on the sum by date. Would I need to declare a variable for each date, that variable being the sum of sweets?

View 4 Replies View Related

Add Column Total At SELECT Pivot

Feb 23, 2015

This SQL Select below doesn't show the total value. Always shows NULL. Why?

SELECT Ano,
FORMAT((QPivot.[1]),'##,##0.00','pt-BR') As trimestre1,
FORMAT((QPivot.[2]),'##,##0.00','pt-BR') As trimestre2,
FORMAT((QPivot.[3]),'##,##0.00','pt-BR') As trimestre3,
FORMAT((QPivot.[4]),'##,##0.00','pt-BR') As trimestre4,
Municipio,

[Code] ....

View 4 Replies View Related

Matrix Report Total Column

Nov 2, 2007

Hi Everyone,

I am designing a report in SQL Server 2005 Report Designer that uses a Matrix table. The matrix table is grouped by month. How can I add a Year-To-Date total column on the report? This is driving me nuts...I cannot figure this out.

Thank You
-Sam

View 1 Replies View Related

Adding Column After Matrix Total

Jan 11, 2007

<P>Greetings,</P>
<P>I am new to reporting services and am struggling with trying to add a column to the end of matrix report that has totals.&nbsp; You can see a jpg of the report at http://www.catertots.com/matrix.jpg What I need to do is repeat the school code that is in the first column into another column that follows the total.&nbsp; </P>
<P>Any help would be much appreciated.</P>

View 3 Replies View Related

How Do I Add A Percentage Column After The Total On A Matrix?

Mar 27, 2007

Hi. I am looking to create a Matrix-based Report in SQL Server 2005 Reporting Services. I have my query, and a dynamic number of both rows and columns. I have Totals on the "bottom" and "right".

What I'd like to do is add a Percentage column to the right of the right-based Totals column. So the columns would read Col1, Col2, .., ColN, Total, Percentage.

Is this possible???

Thanks.

View 12 Replies View Related

Transact SQL :: Add Total Column And Percentage

May 31, 2015

How can I add a Total Column as the last column in this query and also add a total column to the bottom row of the query?  Then after the total column on the right, add a % column.  So my expected returned set would be like so:

Location
       Train
         Bat 
         Ball
     Nuggets
       Total
      %

[code]..

View 12 Replies View Related

Invalid Column Name

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

Invalid Column Name

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

Invalid Column Name &#39;x&#39;

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

Invalid Column Name

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

Invalid Column

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

Invalid Column Name But Right

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

Invalid Column Name

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

Invalid Column Name

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

Why, Invalid Column Name?

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

Invalid Column Name?

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

Invalid Column Name

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

Invalid Column Name

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

Invalid Column Name

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

Transact SQL :: Total Difference Time In Last Column?

May 23, 2015

I have the below query

DECLARE @GivenDate DATE='2015-05-13'
create table #table (LedgerID int,AttDate Date, checkedtime time,checkedtype varchar(1))
insert into #table (LedgerID,AttDate,checkedtime,checkedtype) values (1232,'2015-05-13','09:01:48.0000000','I')
insert into #table (LedgerID,AttDate,checkedtime,checkedtype) values (1232,'2015-05-13','13:05:52.0000000','O')
insert into #table (LedgerID,AttDate,checkedtime,checkedtype) values (1232,'2015-05-13','14:10:25.0000000','I')

[code]....

the result is like below

i need 'TotalDiffernceTime' column as new column (OUT1-IN1)+(OUT2-IN2).

i am using SQLServer 2008 R2

View 8 Replies View Related







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