Ambiguous Values Returned

May 15, 2008

Hello,

I'm brand new to this forum and I'm stuck. We've got a query which queries three tables: booking, catheter and patients. The following (dodgy) query has pulled off the data for years, without problems:


SELECT
CARDIAC_CATHETER.CARDIAC_CATHETER_ID,
CARDIAC_CATHETER.OPERATOR1,
CARDIAC_CATHETER.TEST_DATE,
BOOKING.STATUS,
BOOKING.TEST_DATE AS BOOKING_TEST_DATE,
BOOKING.PROCEDURE_DATE_TIME,
CARDIAC_CATHETER.ITEM_NO,
CARDIAC_CATHETER.BILLING_CATEGORY,
PATIENTS.REFERRING_PHYSICIAN1,
PATIENTS.HOSPITAL_UNIT_NUMBER
FROM
(CARDIAC_CATHETER INNER JOIN PATIENTS ON CARDIAC_CATHETER.PATIENT_ID = PATIENTS.PATIENT_ID)
LEFT OUTER JOIN BOOKING ON PATIENTS.PATIENT_ID = BOOKING.PATIENT_ID AND 'CATHETER' = BOOKING.CLINIC AND BOOKING.STATUS <> 'CANCELLED' AND BOOKING.PROCEDURE_DATE_TIME >= (CARDIAC_CATHETER.TEST_DATE - 1)
AND BOOKING.PROCEDURE_DATE_TIME < (CARDIAC_CATHETER.TEST_DATE + 1)
WHERE
CARDIAC_CATHETER.TEST_DATE > '2005-04-01' AND CARDIAC_CATHETER.BILLING_CATEGORY LIKE '3%'


About 2500 perfect rows and 12 rows which have duplicate catheter id values. There are six pairs of duplicated records. It's only the cardiac_catheter.catheter_id and cardiac_catheter.test_date which are duplicated - the first row shown below contains correct values, the second doens't. The other values returned, on both rows, are correct. Here is some sample data:

CARDIAC_CATHETER_ID
cat_id1234
cat_id1234

CARDIAC_CATHETER_TEST_DATE
19/12/2005 13:17
19/12/2005 13:17

BOOKING_TEST_DATE
19/12/2005 13:33
19/12/2005 08:46

PROCEDURE_DATE_TIME
20/12/2005 10:30
19/12/2005 08:46

CLINIC
CATHETER
CATHETER

I know the query is rubbish. Has anyone got any idea how it can be improved and sorted so that we don't pull back ambiguous data?

Thanks,

Stewart

View 5 Replies


ADVERTISEMENT

NULL Values Returned When Reading Values From A Text File Using Data Reader.

Feb 23, 2007

I have a DTSX package which reads values from a fixed-length text file using a data reader and writes some of the column values from the file to an Oracle table. We have used this DTSX several times without incident but recently the process started inserting NULL values for some of the columns when there was a valid value in the source file. If we extract some of the rows from the source file into a smaller file (i.e 10 rows which incorrectly returned NULLs) and run them through the same package they write the correct values to the table, but running the complete file again results in the NULL values error. As well, if we rerun the same file multiple times the incidence of NULL values varies slightly and does not always seem to impact the same rows. I tried outputting data to a log file to see if I can determine what happens and no error messages are returned but it seems to be the case that the NULL values occur after pulling in the data via a Data Reader. Has anyone seen anything like this before or does anyone have a suggestion on how to try and get some additional debugging information around this error?

View 12 Replies View Related

Using Returned Values From One SP In Another

Jun 20, 2006

Hi all,

I have a SP that needs to return a record set based upon the values of calling another SP. The 2nd SP uses the output parameter and works fine. However, the resulting Insert doesnt see the value. I cannot for the life of me work out why not!

My other question is how do I stop the imbedded procedures from outputing a result? When the procedure is run in analyser it produces three sets of data. The first two being the outputs for the two SPs.

Any help would be much appreciated!

Code as follows:

CREATE PROCEDURE [dbo].[trl_GetOpenDurations] AS

--- CALLS the sp trl_CallOpenDuration with the following params
---1 min minute value - int
---2 max minute value - int
---3 return value - int - interval in minutes

set nocount on

declare @min int --- less than 1 min
declare @hour int --- more than 1 min, less than 1 hour

create table #t ([Type] VARCHAR(10) ,[Value] int)

EXECUTE trl_callOpenDuration 0,1,@min
insert into #t ([Type],[Value]) values ('<1Min', @min)

EXECUTE trl_callOpenDuration 1,60,@hour
insert into #t ([Type],[Value]) values ('<1Hour',@hour)
---get data from table
Select * from #t
GO


RESULTS:

<1Min NULL
<1Hour NULL

View 1 Replies View Related

How Do I Get Uppercase Values Returned Only.

Jul 23, 2005

I have a table where inactive names are lower case and active names areuppercase. Note: Not my design.Anyways I want to select all names form this table where the name isuppercase. I see collate and ASCII pop up in searches but the examplesdon't seem usable in queries as much as they were for creating tablesand such.Thanks,Phil

View 5 Replies View Related

Stored Procedure && Returned Values

Dec 23, 2007

I have a stored procedure that selects * from my table, and it seems to be working fine:
 USE myDB
GO
IF OBJECT_ID ( 'dbo.GetAll', 'P') IS NOT NULL
DROP PROCEDURE GetAll
GO
CREATE PROCEDURE GetAll
AS
DECLARE ref_cur Cursor
FOR
SELECT * FROM myTable
Open ref_cur
FETCH NEXT FROM ref_cur
DEALLOCATE ref_cur
 
The problem is, I'm trying to create a DB class, and I'm not sure what Parameter settings I'm supposed to use for my returned values.  Can anyone help me finish this?public class dbGet_base
{
public dbGet_base()
{
_requestId = 0;
}

public dbGet_base(Int64 RequestId)
{
this._requestId = RequestId;
getDbValues(RequestId);
}
public void getDbValues(Int64 RequestId)
{
getDbValues(RequestId, "GetAll");
}
public void getDbValues(Int64 RequestId, string SP_Name)
{
using(SqlConnection Conn = new SqlConnection(ConfigurationManager.AppSettings["WSConnection"]))
using (SqlCommand Command = new SqlCommand(SP_Name, Conn))
{
Command.CommandType = CommandType.StoredProcedure;
Command.Parameters.Add("@Request_Id", SqlDbType.Int).Value = RequestId;
Command.Parameters.Add(??
}

View 3 Replies View Related

Any Way To Check If All The Values In A Column Returned Are The Same Value?

Jan 4, 2005

say i have a table, and in it are two columns, column1 and column2 and i do the following query:

SELECT column1, column2 FROM table WHERE column2 = '12345'

i want to check if column1 has all the same values, so in the first case, no


column1 column2
------- --------
4 12345
9 12345
5 12345




column1 column2
------- --------
9 12345
9 12345
9 12345


in the 2nd case, column1 contains all the same values, so yes

is there anyway i can check this? i would be doing this in a trigger.. say when a new row is inserted, the value of column1 is inserted, but col 2 is null.. so when they try to fill in the value for col2 of that row, the trigger checks to see if the value they put for col 2 is already in the table.. if it isn't, then everything is ok. but if it is already in teh table, then it checks col1 to see if all the values of col1 are the same

i hope this makes sense

thanks

View 2 Replies View Related

Query Results - Not Getting Different Values Returned For Each Row

Jan 24, 2012

I am getting the following results from my query that contains a subquery, but I don't understand why the values in the [Total Volume M_Active_Previous] are being repeated with the same value. I should be getting different values returned for each row like in the [Total Volume M_Active] column.

Why the values are all the same and how I can fix this?

DayNoDayTotal Volume M_ActiveTotal Volume M_Active_Previous
6 Friday11161 72491
7 Saturday5687 72491
2 Monday14354 72491
1 Sunday3966 72491
4 Wednesday12340 72491
3 Tuesday12018 72491
5 Thursday11833 72491

Here is the SQL I'm using.

Code:
DECLARE @StartDate datetime, @EndDate datetime, @Prev_StartDate datetime, @Prev_EndDate datetime
SET @StartDate = '2011-03-13 00:00:00.000'
SET @EndDate = '2011-03-19 23:59:59.999'
SET @Prev_StartDate = '2011-03-06 00:00:00.000'
SET @Prev_EndDate = '2011-03-12 23:59:59.999'

[Code] ....

View 5 Replies View Related

Changing Values Returned...Newbie Needs Help.

May 29, 2008

Hi Guys,

I have had a look through the forum and I can't seem to be able to find how to do this... I have a vague recollection of achieving this before but it was many years ago since I've done any sql.

I have a table like this

StaffID JobNumber Status
------- --------- ------
1 50 'In Progress'
2 20 'On Hold'
3 30 'Completed'
4 40 'Completed'


what I want to be able to do is change the status to something common if it is not 'Completed' I don't want to update the database though, I just want to return it in a select statement. Is this possible.

My output would be something like;

StaffID JobNumber Status
------- --------- ------
1 50 'NOT Completed'
2 20 'NOT Completed'
3 30 'Completed'
4 40 'Completed'

Many thanks in Advance.

Bobg

View 3 Replies View Related

Reading Values Returned From A Stored Procedure

Nov 10, 2000

I am trying to use a stored procedure inside the scripter in a site server pipeline. Can anyone tell me how the scripter will read the the result which is a variable. The stored procedure is returning the right value when run in query analyzer but I don't know how to retrieve it inside the pipeline.

Thank you
JG

View 1 Replies View Related

Having Rows With Some Null Values Returned Conditionally

Aug 8, 2012

This should be a simple solution, but it has been a long time since I've done any query writing (mostly in Oracle) and I am stumped, so here goes:

We are in the process of converting Access database to MSSQL with web form front ends.

I have a table, all columns are nullable, and want users to be able to query from a form, which has a field for each column and defaults to a % wild card for the entered value.

I want the users to be able to put any string in any field, and have it return each row that matches that, including rows with null values in the other columns, but not the column with the entered criteria.

Here is a sample of the data:

Code:
SQL> select * from test;

COL1 COL2 COL3 COL4
----- ----- ----- -----
this is a test
this is not test
this is not
this is test too
is test too
is too
is too

7 rows selected.

Now, if I have this SQL run, it will return only rows that have no nulls in any columns:

Code:
select
col1,
col2,
col3,
col4from test
where
col1 like'th%'
and col2 like '%'
and col3 like '%'
and col4 like '%';

COL1 COL2 COL3 COL4
----- ----- ----- -----
this is a test
this is not test
this is test too

Now, if I use an OR clause for each column, this mostly works, but the trouble is it will also return rows with null values for the field that has criteria entered in it:

Code:
select
col1,
col2,
col3,
col4from test
where
(col1 like'th%' OR col1 is null)
and (col2 like '%' OR col2 is null)
and (col3 like '%' OR col3 is null)
and (col4 like '%' OR col4 is null);
COL1 COL2 COL3 COL4
----- ----- ----- -----
this is a test
this is not test
this is not
this is test too
is test too
is too
is too

The idea is to only select the first 4 rows in the above example.

I was playing with ISNULL in the select clause, but all it does is substitute a string for a null, and I think CASE will do the same thing.

Is there a way I can write this query so it will return rows with NULL values in any column, except the one(column) that has user entered criteria in it?

View 9 Replies View Related

Query Round Off To Zero...no Real Values Returned Ever.

Apr 29, 2004

The query below gets percentage of coils for a location by anneal cycle. It does this correctly (ie, if you change count(*)/b.total to count(*), b.total ... show both columns, the numbers its pulling are correct), but in its current state (trying to divide count by total), it always returns a zero (no decimal values).

If I change that section to : (count(*)*100/ b.total*100)/100, I get integer percentages: no decimals (this is a problem because some records round off to zero). I'm pretty sure this is the entire problem (why I'm getting zeros as written below), but I don't have a clue how to fix it. Is this some kind of server setting that allows the query to only return decimal values or something?



select a.department, a.cycle, count(*)/ b.total percentage
from inventory a join (select department, count(*) total from inventory
where location not like 'bas%' and archived = 0 and quality_code = 'p'
group by department) b on a.department = b.department
where a.archived = 0 and a.quality_code = 'p' and location not like 'bas%'
group by a.department, a.cycle, b.total
order by a.department, a.cycle

View 2 Replies View Related

Using Values Returned From SQL For Report Column Names

Apr 17, 2008

I am building reports against our TFS development db.
One of the reports tracks days spent (Dwell Time) in various status categories (eg: New, Assigned, In Development, Hold, etc) for a given "ticket".
For a fixed list of values from {Work Item].System_State, I can send the results (days in Assigned) to the column named (Assigned) for each status for each event in the [Work Item History], and then sum them for each ticket as:
Ticket ID New Assigned InDev etc
1230001 2 0 0 ...
1230001 0 1 2 ....

SUM 2 1 2 ....
However, I have many different Projects, each of which use their own Status names.
I don't want to duplicate the same basic report, if I can avoid it.

How can I name and generate this data for the unique Status list for each Project?

Simplest analog is: name = First(Fields!Status.Value, "TFSdb")
and allows value for a column name (category) as: =IIF(Fields!Status.Value = First(Fields!Status.Value, "TFSdb"), Fields!Days.Value, 0)
However this fails beause:
1. It only delivers the FIRST status value, and,
2. I cannot SUM an expression which is itself an aggregate (using First).

View 4 Replies View Related

Values For SEARCHABLE Column Returned From Sp_datatype_info

Sep 15, 2006

I have a question regarding the values returned in the SEARCHABLE column of the system stored procedure sp_datatype_info. What do ALL of the values mean? The SQL Server BOL only provides meanings for the values 0 and 1, but I am also seeing values 2 and 3. What are the meanings of these values?

Thanks,
Sean

View 2 Replies View Related

MSOLAP_NODE_SCORE Values Returned By Store Proc DTGetNodeGraph

Oct 19, 2006

Hello--

For extracting the link structure of a dependency network with a large number of nodes (for problems having a large number of variables), we have been using the stored procedure:

System.Microsoft.AnalysisServices.System.DataMining.DecisionTreesDepNet.DTGetNodeGraph('{model-name}', value)

The stored procedure returns a resultset with columns: [Node_type], [Node_unique_name_1], [Node_unique_name_2], and [MSOLAP_NODE_SCORE]

Are there any pointers, references or descriptions of the values of [MSOLAP_NODE_SCORE]?

Thanks,

- Paul

View 5 Replies View Related

Can The OLE DB Command Transformation Support Multiple Values Returned By A Stored Procedure Or Is The Limit One Value Only?

Apr 10, 2007

I have no problem getting OLE DB Command transformations to support single returns by a procedure.

For example, exec name_of_procedure ?,?,? OUTPUT



However, I have a stored procedure which accepts 1 input and returns 5 outputs. This procedure works fine at the command line but when I try to incorporate it into a OLE DB Command I don't get the multiple values returned. There's no problem at all configuring the transform as it recognizes all input and output parameters. For some reason I just don't get values returned.



thanks

John

View 14 Replies View Related

Integration Services :: SSIS Excel Data Source Numeric Values Returned As Null

May 8, 2009

I'm using SSIS 2005 Enterprise edition,  I'm creating a package that reads an excel (xls) file using the "excel source" component, and it dumps the data into an OLEDB destination (a sql server). When I drag the excel source component and create the excel connection to my file the component automatically reads the columns and their datatypes.

The problem is that I have a column which has numeric data and the package uploads as NULL every number that starts with a zero. (note: in excel this column is formatted as "text", despite it has only numbers, because it's the only way excel maintains the left sided zeros).

So I checked the data types by right clicking the excel source component -> show advanced editor and my surprise is that this column's data type is detected as double-precision float, and it doesn't let me change it. URL... but it only works when the first row of data has a number beginning with zero on this column. How to get the data imported correctly?

View 15 Replies View Related

Reporting Services :: Date Range Filter Based On Date Values Returned In Report?

Aug 27, 2015

I have a QA Deployment Date field that is being returned in a custom report I created. I also found a sample date range parameter:

What I want to accomplish:

I want to select a From and To Date and filter the report to only display the rows that have the QA Deployment Date within the selected range.

For example.. I want to select From Date (8/1/2105) and To Date (8/31/2015) and I only want to return only the results that have a QA Deployment date between that selected range.

View 3 Replies View Related

Data Returned From .WriteXML Is Different Than What Is Returned In Query Analyzer.

Jun 20, 2006

I have a strange problem. I have some code that executes a sql query. If I run the query in SQL server query analyzer, I get a set of data returned for me as expected. This is the query listed on lines 3 and 4. I just manually type it into query analyzer.
Yet when I run the same query in my code, the result set is slightly different because it is missing some data. I am confused as to what is going on here. Basically to examine the sql result set returned, I write it out to an XML file. (See line 16).
Why the data returned is different, I have no idea. Also writing it out to an XML file is the only way I can look at the data. Otherwise looking at it in the debugger is impossible, with the hundreds of tree nodes returned.
If someone is able to help me figure this out, I would appreciate it.
1. public DataSet GetMarketList(string region, string marketRegion)2. {3.   string sql = @"SELECT a.RealEstMarket FROM MarketMap a, RegionMap b " + 4."WHERE  a.RegionCode = b.RegionCode"; 5.   DataSet dsMarketList = new DataSet();6.   SqlConnection sqlConn = new SqlConnection(intranetConnStr);   7.   SqlCommand cmd = new SqlCommand(sql,sqlConn);8.  sqlConn.Open();9.   SqlDataAdapter adapter = new SqlDataAdapter(cmd); 10.   try11.   {12.   adapter.Fill(dsMarketList);
 13.  String bling = adapter.SelectCommand.CommandText;//BRG 14.   dsMarketList.DataSetName="RegionMarket"; 15.  dsMarketList.Tables[0].TableName = "MarketList"; 16.    dsMarketList.WriteXml(Server.MapPath ("myXMLFile.xml" )); // The data written to  17. myXMLFile.xml is not the same data that is returned when I run the query on line 3&4 18.           // from the SQL query 19.  } 20.  catch(Exception e) 21. {  22. // Handle the exception (Code not shown)

View 2 Replies View Related

Ambiguous Error

Oct 27, 2003

I am receiving an error:

[Macromedia][SQLServer JDBC Driver][SQLServer]Ambiguous column name 'Employee_Id'.


This is my SQL/CF code:

<cfquery name="GetEmployee" datasource="CF_CSTS_DSN" >
SELECT *
FROM CST_EmployeeTraining INNER JOIN CST_Employee ON CST_EmployeeTraining.Employee_ID=CST_Employee.Empl oyee_ID
WHERE 1=1
<cfif isdefined("Form.Employee_ID")> AND Employee_ID='#FORM.Employee_ID#'</cfif>
<html>
<head> <title>Data Request</title> </head>
<body>
<div align="center">
<img src="CSTshorthead.jpg" width="580" height="72" border="0">
</div>
<cftable query="GetEmployee" startrow="1" colspacing="2" htmltable colheaders>
<cfcol header="<b>Employee ID</b>"
width=10
text="#Form.Employee_ID#">
<---!more code follows--->

Any ideas?
Thanks!
H

View 14 Replies View Related

Ambiguous Column Name?

May 30, 2008

....
nothing...please see the below...

View 12 Replies View Related

Ambiguous Column Name

Jul 13, 2007

Dear experts,
while i'm trying to insert data , i got error like
Ambiguous column name...that is related to joins
the query is
INSERT INTO MATABLE044
SELECT newid(), ledger.COLUMN002, wh.COLUMN001, Loc.COLUMN005, ledger.COLUMN008, ledger.COLUMN009, ledger.COLUMN010, ledger.COLUMN011,0,
1-1-1900, ledger.COLUMN006, ledger.COLUMN007, ledger.COLUMN014, 'Y', ledger.column016,ledger.COLUMN020, ledger.COLUMN021, ledger.COLUMN022,ledger.COLUMN023,
ledger.COLUMN024,ledger.COLUMN025,ledger.COLUMN026,ledger.COLUMN027,Loc.COLUMN005,ledger.COLUMN029,ledger.COLUMN030,ledger.COLUMN002EE,
'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','SNSP_BRANCH','SNSP_BRANCH','SNSP_USER',convert(varchar(19),getdate(),120),NULL,convert(varchar(19),getdate(),120),newid(),'DBMS_REPUTIL.GLOBAL_NAME','en'

FROM MATABLE043 ledger
Inner JOIN MATABLE012 wh on ledger.column002 = wh.column002
Inner JOIN MATABLE024 Loc on wh.column001 = loc.column004
WHERE COLUMN002 ='c5a0bcc4-743a-4d9a-80a5-7c2ebbf6deec' and COLUMN006 = '3d42a36e-7df7-41cd-a6ee-189f4e3f2ad5'
AND COLUMN009 NOT IN ( SELECT COLUMN006 FROM MATABLE044)

what is the meaning


thank you very much

Vinod
Even you learn 1%, Learn it with 100% confidence.

View 2 Replies View Related

Ambiguous Column Name?

Mar 31, 2008

I'm getting an 'Ambiguous column name 'Converted_Mortgage_Number' with this SQL/php query. Can anyone please see why?


DECLARE
@PageSize INT,
@PageNumber INT,
@FirstRow INT,
@LastRow INT

SELECT@PageSize = $pageLength,
@PageNumber = $pageNumber;

SELECT@FirstRow = ( @PageNumber - 1) * @PageSize + 1,
@LastRow = (@PageNumber - 1) * @PageSize + @PageSize ;


WITH results AS


( SELECT


t1.[Converted_Mortgage_Number],
t1.[Converted_Mortgage_Advance_No],
t1.[Original_Account_Number],
CASE
WHEN t3.description IS NOT NULL
THEN t3.description
ELSE t1.CACS_Location_Code
END AS CACS_Location_Code,
t1.[Original_Account_Number_1],
t1.[Payment_Amount],
t1.[Letter_ID],
t1.[Batch_Activity_Date],
t1.[Activity_Date],
t1.[Activity_Time],
CASE
WHEN t6.description IS NOT NULL
THEN t1.[Collection_Activity] + ' - '+ t6.description
ELSE t1.[Collection_Activity]
END AS [Collection_Activity],
CASE
WHEN t5.description IS NOT NULL
THEN t1.[Party_Contact_Code] + ' - ' + t5.description
ELSE t1.[Party_Contact_Code]
END AS [Party_Contact_Code],
CASE
WHEN t7.description IS NOT NULL
THEN t1.[Place_Called] + ' - ' + t7.description
ELSE t1.[Place_Called]
END AS [Place_Called],
t1.[Promise_Amount_1],
t1.[Promise_D_ate_1],
t1.[Promise_Amount_2],
t1.[Promise_D_ate_2],
CASE
WHEN t8.description IS NOT NULL
THEN t1.[Non_Pay_Excuse_Code] + ' - ' + t8.description
ELSE t1.[Non_Pay_Excuse_Code]
END AS [Non_Pay_Excuse_Code],
CASE
WHEN t2.description IS NOT NULL
THEN t1.CACS_State + ' - ' + t2.description
ELSE t1.CACS_State
END AS CACS_State,
t1.[User_ID/Transaction_Type],
t1.[Arrears_Amount],
t4.[Sequence_Number],
t4.[History_Text],
ROW_NUMBER() OVER (ORDER BY [$criteria] $direction) AS RowNumber

FROM format_cacs_cch AS t1

LEFT OUTER JOIN format_cacs_history_1 AS t4
ON t1.Converted_Mortgage_Number = t4.Converted_Mortgage_Number
AND t1.Activity_Date = t4.Activity_Date
AND t1.Activity_Time = t4.Activity_Time

LEFT JOIN sd_cacs_states AS t2
ON t1.CACS_Location_Code = t2.location
AND t1.CACS_State = t2.state

LEFT JOIN sd_cacs_Location_details AS t3
ON t1.CACS_Location_Code = t3.code

LEFT JOIN sd_party_contacted_code AS t5
ON t1.[Party_Contact_Code] = t5.code

LEFT JOIN sd_collection_activity_code AS t6
ON t1.[Collection_Activity] = t6.code

LEFT JOIN sd_place_called AS t7
ON t1.[Place_Called] = t7.code

LEFT JOIN sd_non_pay_excuse_code AS t8
ON t1.[Non_Pay_Excuse_Code] = t8.code

WHERE (t1.Converted_Mortgage_Number = '$mortgage' $additional_date_params)



)

SELECT

[Converted_Mortgage_Number],
[Converted_Mortgage_Advance_No],
[Original_Account_Number],
CACS_Location_Code,
[Original_Account_Number_1],
[Payment_Amount],
[Letter_ID],
[Batch_Activity_Date],
[Activity_Date],
[Activity_Time],
[Collection_Activity],
[Party_Contact_Code],
[Place_Called],
[Promise_Amount_1],
[Promise_D_ate_1],
[Promise_Amount_2],
[Promise_D_ate_2],
[Non_Pay_Excuse_Code],
CACS_State,
[User_ID/Transaction_Type],
[Arrears_Amount],
[Sequence_Number],
[History_Text]

FROM results

WHERERowNumber BETWEEN @FirstRow AND @LastRow
ORDER BY [$criteria] $direction ;

View 5 Replies View Related

Ambiguous Variable Name?

Oct 10, 2007

Hi,

I have a package that I migrated from DTS. There are several "execute SQL" tasks that take an Input parameter of "myVariable", which is a string defined at the package level and has a default value assigned to it.

However, the package is throwing this error:

Error 1 Validation error. Err LogComletion : Failed to lock variable "myVariable" for read access with error 0xC001F032 "The variable name is ambiguous because multiple variables with this name exist in different namespaces. Specify namespace-qualified name to prevent ambiguity.".

How come I cannot use this variable when defined at the package level? If I move the variable to the task level, it works fine, but I want to re-use the variable in several places in the package.

Thanks

View 3 Replies View Related

Ambiguous Column Name Problem

Apr 8, 2008

I have a problem when running the code after I select an item from the dropdownbox and click select: 1 <%@ Page Language="C#" MasterPageFile="~/Default.master" Title="View Orders allocated to Ships" %>
2 <%@ import namespace="System.Data.SqlClient" %>
3
4 <script runat="server">
5
6 protected void ShipIDSelect_Click(object sender, EventArgs e)
7 {
8 SqlConnection conn;
9 SqlCommand comm;
10 SqlDataReader reader;
11 string connectionString =
12 ConfigurationManager.ConnectionStrings[
13 "ShippingSystemConnectionString1"].ConnectionString;
14 conn = new SqlConnection(connectionString);
15 comm = new SqlCommand(
16 "SELECT OrderID, CustomerID, Date, NumberofItems, DescriptionsofItems, SafeItems, Destination FROM [Order] o, Ordersonship os " +
17 "WHERE os.ShipID = @ShipIDDropDownList " +
18 "AND o.OrderID = os.OrderID", conn);
19 comm.Parameters.Add("@ShipIDDropDownList", System.Data.SqlDbType.Int);
20 comm.Parameters["@ShipIDDropDownList"].Value = Convert.ToInt32(ShipIDDropDownList.SelectedValue);
21
22 conn.Open();
23 reader = comm.ExecuteReader();
24 if (reader.Read())
25 {
26 orderIDLbl.Text = reader["OrderID"].ToString();
27 customerIDLbl.Text = reader["CustomerID"].ToString();
28 dateLbl.Text = reader["Date"].ToString();
29 numofitemsLbl.Text = reader["NumberofItems"].ToString();
30 descripofitemsLbl.Text = reader["DescriptionsofItems"].ToString();
31 safeLbl.Text = reader["SafeItems"].ToString();
32 destinationLbl.Text = reader["Destination"].ToString();
33 }
34 reader.Close();
35 conn.Close();
36 conn.Dispose();
37 }
38 </script>
39
40 <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
41 <br />
42 <table style="position: static">
43 <tr>
44 <td style="width: 147px">
45 <strong>ShipID:</strong></td>
46 <td style="width: 100px">
47 <asp:DropDownList ID="ShipIDDropDownList" runat="server" DataSourceID="SqlDataSource1"
48 DataTextField="ShipID" DataValueField="ShipID" Style="position: static">
49 </asp:DropDownList>
50 <asp:Button ID="ShipIDSelect" runat="server" Style="position: static" Text="Select" OnClick="ShipIDSelect_Click" />
51 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ShippingSystemConnectionString1 %>"
52 SelectCommand="SELECT [ShipID] FROM [OrdersonShip]"></asp:SqlDataSource>
53 </td>
54 <td style="width: 100px">
55 </td>
56 </tr>
57 <tr>
58 <td style="width: 147px">
59 </td>
60 <td style="width: 100px">
61 </td>
62 <td style="width: 100px">
63 </td>
64 </tr>
65 <tr>
66 <td style="width: 147px">
67 <strong>OrderID:</strong></td>
68 <td style="width: 100px">
69 <asp:Label ID="orderIDLbl" runat="server" Style="position: static" Text="" Width="178px"></asp:Label></td>
70 <td style="width: 100px">
71 </td>
72 </tr>
73 <tr>
74 <td style="width: 147px">
75 <strong>CustomerID:</strong></td>
76 <td style="width: 100px">
77 <asp:Label ID="customerIDLbl" runat="server" Style="position: static" Text="" Width="177px"></asp:Label></td>
78 <td style="width: 100px">
79 </td>
80 </tr>
81 <tr>
82 <td style="width: 147px; height: 21px">
83 <strong>Date:</strong></td>
84 <td style="width: 100px; height: 21px">
85 <asp:Label ID="dateLbl" runat="server" Style="position: static" Text="" Width="177px"></asp:Label></td>
86 <td style="width: 100px; height: 21px">
87 </td>
88 </tr>
89 <tr>
90 <td style="width: 147px; height: 21px">
91 <strong>Number of Items:</strong></td>
92 <td style="width: 100px; height: 21px">
93 <asp:Label ID="numofitemsLbl" runat="server" Style="position: static" Text="" Width="177px"></asp:Label></td>
94 <td style="width: 100px; height: 21px">
95 </td>
96 </tr>
97 <tr>
98 <td style="width: 147px">
99 <strong>Description of Items:</strong></td>
100 <td style="width: 100px">
101 <asp:Label ID="descripofitemsLbl" runat="server" Style="position: static" Text="" Width="178px"></asp:Label></td>
102 <td style="width: 100px">
103 </td>
104 </tr>
105 <tr>
106 <td style="width: 147px">
107 <strong>Are Items Safe?:</strong></td>
108 <td style="width: 100px">
109 <asp:Label ID="safeLbl" runat="server" Style="position: static" Text="" Width="177px"></asp:Label></td>
110 <td style="width: 100px">
111 </td>
112 </tr>
113 <tr>
114 <td style="width: 147px">
115 <strong>Destination:</strong></td>
116 <td style="width: 100px">
117 <asp:Label ID="destinationLbl" runat="server" Style="position: static" Text="" Width="177px"></asp:Label></td>
118 <td style="width: 100px">
119 </td>
120 </tr>
121 </table>
122 </asp:Content> I get a Ambiguous column name 'OrderID'. Error. How do I fix it?The stack trace is below: [SqlException (0x80131904): Ambiguous column name 'OrderID'.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +98 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +82 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +3430 System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +52 System.Data.SqlClient.SqlDataReader.get_MetaData() +130 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +371 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1272 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +334 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +45 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +162 System.Data.SqlClient.SqlCommand.ExecuteReader() +114 ASP.ships_viewordersonship_aspx.ShipIDSelect_Click(Object sender, EventArgs e) in c:SystemShipsViewOrdersonShip.aspx:23 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +96 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +116 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3824  Regards, Peter   

View 5 Replies View Related

Ambiguous Match Found.

Nov 3, 2003

Does anyone know what this error means?

Ambiguous match found.

i'm using sql server 2000


here is my code

Dim con As SqlConnection = New SqlConnection

con.ConnectionString = _
"Data Source=localhost;" + _
"Initial Catalog=registeruser;" + _
"User ID=int422;" + _
"Password=int422"


Dim cmd As SqlCommand = New SqlCommand

cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT salt,hash FROM users WHERE login_id = '" + user.Text + "'"


Dim rdr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)


con.Open()

Dim salt, hash As String



While rdr.Read()


If user.Text = rdr.Item("login_id").ToString() Then

salt = rdr.Item("salt").ToString()
hash = rdr.Item("hash").ToString()


End If


End While

con.Close()


Label1.Text = salt



End Sub

View 1 Replies View Related

SQL 2012 :: Ambiguous Column Name

Mar 21, 2014

I'm planning an upgrade to SQL Server 2012 and noticed the following.

We have a query that includes a duplicate column name in the SELECT statement. This query happens to work in a db we have that is set to SQL 2000 (80) compatibility level, but the same exact query fails when I set the db to SQL 2008 (100) compatibility level.

The error is (ColumnName is just an example):

Ambiguous column name 'ColumnName'

View 7 Replies View Related

UPDATE Ambiguous Column Name

Oct 21, 2005

I'm running into problems with ambiguous column names. TransID also exists in tblWork. I tried adding SHPD + WORK, but it won't accept the SHPD on the UPDATE line. How do I code around this error? Thanks.
UPDATE tblShipmentDet SHPD
SET
SHPD.Quantity = WORK.Quantity
FROM tblWork WORK
WHERE TransID = WORK.RecordID

View 9 Replies View Related

Ambiguous Column Name Error

Nov 16, 2006

Hi,

I am getting an ambiguous column name error, but I am aliasing the column in question. The problem seems to be that I'm trying to use the same column in 2 inner joins:

select trackprice.id from trackprice tp
inner join track tr on tp.trackid = tr.id
inner join trackstorage ts on ts.trackid = tr.id
inner join ... etc ....

.... gives me the error 'ambiguous column name trackid' - can this not be done with inner joins this way?

Thanks,
Alex

View 2 Replies View Related

QA Tells Me My Table Is Ambiguous

Jul 23, 2005

Can someone help with this syntax? I have a non-sensicle examplebelow, but it illustrates the problem if you copy/paste into QA.**********************************use pubsgoupdate authors set address = 'some address'from authors ainner join authors a2 on a.zip = a2.zip---------------------------------------------Server: Msg 8154, Level 16, State 1, Line 2The table 'authors' is ambiguous.**********************************

View 3 Replies View Related

Ambiguous Column Name 'ACCOUNTNO'.

Mar 18, 2008



i have a problem in my Goldmine 6.7 corporate version when one of the user try to do some thing this error msg came

General SQL error.
Native SQL error: 209
Context: SQLQuery: GoldMine:
SELECT c1.Company,c1.Contact,c1.RecID,c1.owner,c1.status, c1.AccountNo, c2.AccountNo FROM dbo.CONTACT1 c1 (NOLOCK), dbo.CONTACT2 c2 (NOLOCK) WHERE ((c1.U_KEY4 = 'ANWAY' AND c2.UTAG = 'FOCUS') AND (c1.ACCOUNTNO = c2.ACCOUNTNO)) ORDER BY ACCOUNTNO
1: Server message: Ambiguous column name 'ACCOUNTNO'.
BDE Error Cat:Code: [51:3]
BDE: 500 [4/11/1999] GoldMine: 6.70.70226
User: ANWAY
Window: Filters and Groups
&Cancel
Template:
Details:
NATIVEMSG: Ambiguous column name 'ACCOUNTNOneed ur help

View 4 Replies View Related

Ambiguous Column Name (error Message)

May 4, 2008

Hi ,
I have Three Table
1- Student           m  <----- > m          2 - Exam                  3- Registeration                                  
 Std_ID                                              E_ID                       Std_ID
Std_FName                                        E_Name                 E_ID
                                                                                       Reg_Date
------------------------------------------------------------------------------------------------------------------------------------------
Ok... now ...  I  create  StoredProcedure to Return values ( Std_FName , E_exam , Reg_Date )ALTER PROCEDURE dbo.StdExamInfo
@StdNumber as int
AS
/* SET NOCOUNT ON */select Std_FName, Reg_Date, E_Name
from Student inner join Registeration
on Student.Std_ID = Registeration.Std_IDinner join Exam
on Registeration.E_ID = Exam.E_IDwhere Std_ID = @StdNumber
RETURN
but it does't work  I have this error message ( Ambiguous column name )
sorry for this long message

View 2 Replies View Related

Ambiguous Length Varbinary Variable

Jun 24, 2008

Hi,

I'm trying simple code:

declare @varbinary varbinary(8000)
set @varbinary = 2592
print len( @varbinary )

number length
2590 4 bytes
2591 4 bytes
2592 3 bytes ????
2593 4 bytes

All number in range 1 - 9000 has length 4 bytes except these numbers:

32,288,544,800,1056,1312,1568,1824,2080,2336,2592,2848,3104,3360,3616,3872,4128,4384,4640,4896,5152,5408,5664,5920,6176,6432,6688,6944,7200,7456,7712,7968,8480,8736,8992

These numbers has length 3 bytes !

Why?

I´m using varbinary variable to transport ID values and parsing in loop

set @cnt = len( @binEmpIDList ) / 4 -- 4 length
....
insert into @List( ID ) values( substring( @varbinary, @i * 4 + 1, 4 ) )
...

but this algorithm malfunctioning in enumerated numbers.

Please help, how correct this.
ID values in @varbinary too much. I cannot using convert varbinary to bigint and convert bigint to string.


Dalibor

View 7 Replies View Related

Aggregate Function/Ambiguous Trouble

Nov 18, 2007

I'm a newb and this has been giving me a trouble for a while.



Code Block
SELECT class.classcode, classname, instrFirst, instrLast, csDay, CONVERT(nvarchar(30), csStart, 8), CONVERT(nvarchar(30), csEnd, 8)
FROM class, class_section, instructor
WHERE class.classcode = class_section.classcode
Group By className
Order By classname, csNum;






Msg 8120, Level 16, State 1, Line 1

Column 'class.classCode' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.


class and instructor and class_section are their own tables but classcode and instrID are foreign keys on the class_section table. If anyone can explain this as clearly as possible that would be great (the help examples are usually too complicated)

View 6 Replies View Related







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