Where FieldName Is Like ‘*value*’ Pb

Nov 21, 2004

/************************************************/
Database db=new Database();
db.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor(this.JdbcOdbc,
"", "", false, "sun.jdbc.odbc.JdbcOdbcDriver"));
SQL=” SELECT * FROM tableName WHERE fieldname is like ‘*value *’”;
QueryDataSet q= new QueryDataSet();
q.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(db, s, null, true, Load.UNCACHED));

/************************************************/

This return me a data set containing rows where fieldname is exactly like ‘*value *’. The expected data set is set of rows where fieldname=”value 1”or fieldname=”the value 1” or fieldname=”dgdgvalue 04121”, for example.

Here JBuilder considers the character ‘*’ not a special one (idem for the character ‘?’).

This problem is also faced with any other programming language (If I don’t make an error!!)

Please help me to get returned the right data set returned.

Thanks…

View 3 Replies


ADVERTISEMENT

Selecting FieldName From The Table

Sep 23, 2007

How can i just select filed name from the name without data. What query should we write foe that.

View 2 Replies View Related

Distinct Count(fieldname)

Jan 28, 1999

hi, I have a table that contain(custname,ordno,ordchange,ordlocation,reaso n)
I want to determine the following:
how many orders per customer,how many orders changed per customer,how many order location per customer, what reason for change per customer,

here what I wrote as a query, tell me if I am right. I thank you for your help

select custname, COUNT(DISTINCT ordno) ,
COUNT(DISTINCT ordchange) ,
COUNT(DISTINCT ordlocation) ,
COUNT( reason)
from customers a, orders b
where a.custname =b.custname
group by custname

View 1 Replies View Related

Error:Column 'FieldName' Is Constrained To Be Unique. Value '0' Is Already Present

Jan 18, 2008

Hi,
Can anyone help me?
when I am inserting a record to a dataset I am getting  Column 'FieldID' is constrained to be unique.  Value '0' is already present.
I have 2 fields in table like FieldID,FieldName where FieldID id is Primary key and identity column
I am not inserting any value to FieldID as it is identity column.
DataRow newDR= dbDataSet.Tables[strTable].NewRow();for (int i = 0; i < e.Row.Cells.Count; i++)
{ if ( e.Row.Cells[i].Key != "FieldID" )
{if (e.Row.Cells[i].Value != null)
{
newDR[e.Row.Cells[i].Key] = e.Row.Cells[i].Value;dbDataSet.Tables[ strTable].Rows.Add(newDR);
}
}
Some times it is woking fine with out any error............
 
thanks..

View 3 Replies View Related

Stored Proc Using Variable As Fieldname In Select Statment

Apr 20, 2001

Using SQL Server 7 I am trying to modify an existing stored proc and make it more flexible. The below example represents the first part of that proc. The temp table that it should return is then used by another part of the proc (this query represents the foundation of my procedure). I need to figure a way to change the SQL Select statement, choosing between C.CONTRACTCODE and CB.EMPLOYERCODE on the fly. The query below will run but no records are returned. I am starting to believe/understand that I may not be able to use the @option variable the way I am currently.

I've tried creating two SQL statements, assigning them as strings to the @option variable, and using EXEC(@option). The only problem with this is that my temp table (#savingsdata1) goes out of scope as soon as the EXEC command is complete (which means I can not utilize the results for the rest of the procedure). Does anyone know how I can modify my procedure and incorporate the flexibility I've described?

Thanks,

Oliver

CREATE PROCEDURE test
@ContractCode varchar(10),
@dtFrom datetime,
@dtTo datetime,
@Umbrella int

AS

declare @option varchar(900)


if @umbrella = 0
set @option = 'c.contractcode'
else
set @option = 'cb.employercode'

select
c.claimsno,
c.attenddoctor,
c.patientcode,
p.sex,
cb.employercode
into #SavingsData1
from claimsa c inner join Patient p
on c.patientcode = p.patientcode
inner join claimsb cb on c.claimsno = cb.claimno
where
@option = @ContractCode and c.dateentered between @dtFrom and @dtTo
and c.claimsno like 'P%' and p.sex in('M','F') and c.attenddoctor <> 'ZZZZ'

select * from #SavingsData1

View 1 Replies View Related

Multi-part Identifier Alias.fieldname Could Not Be Bound... Help Me!!

Feb 16, 2007

Hello everyone!

I'm having a problem in using MS SQL 2005 as an ODBC in Powerbuilder 10.

My query which seems to work in Powerbuilder 5 does not work in Powerbuilder 10.

When I execute my query, I got this message "multi-part identifier alias.fieldname could not be bound. I don't know what's seems wrong. I even tried putting no alias but still it won't work..

help me please...

select sc.transaction_code,
case when :as_transtype = '' then drh.so_number else case when :as_transtype = 'SI' then drh.si_number else case when :as_transtype = 'DR' then drh.dr_number else :ad_documentnumber end end end document_number,
case when :as_transtype = '' then drh.so_date else case when :as_transtype = 'SI' then drh.si_date else case when :as_transtype = 'DR' then drh.dr_date end end end transaction_date,
pcd.item_number,
pcd.serial_number,
pcd.serv_tag,
pcd.rev_no,
space(10) supplier_name,
c.customer_name,
pcd.pcc_number,
pcd.supplier_refdocno,
pcd.ref_date,
pcd.original_tag,
pcd.item_description
from pcc_detail pcd
inner join pcc_header pch
on pch.pcc_number = pcd.pcc_number
inner join delivery_receipt_header drh
on pch.so_number = drh.so_number
inner join stock_card sc
on sc.so_number = drh.so_number and
sc.item_number = pcd.item_number
inner join customer c
on drh.customer_code = c.customer_code
where sc.transaction_code in ('DR', 'SE') and
sc.transaction_type <> 'RS' and
sc.item_number like case when :as_itemnumber = '' then sc.item_number else '%' + :as_itemnumber + '%' end and
pcd.serv_tag like case when :as_servicetag = '' then pcd.serv_tag else '%' + :as_servicetag + '%' end and
pcd.serial_number like case when :as_serialnumber = '' then pcd.serial_number else '%' + :as_serialnumber + '%' end and
pch.customer_name like case when :as_customer = '' then pch.customer_name else '%' + :as_customer + '%' end and
:as_transtype in ('SO','SI','DR','PC','') and
sc.transaction_code = case when :as_transtype = 'SI' then 'SE' else 'DR' end and
( pch.so_number = case when :ad_documentnumber = 0 then pch.so_number else :ad_documentnumber end or
pch.si_number = case when :ad_documentnumber = 0 then pch.si_number else :ad_documentnumber end or
pch.pcc_number like case when :ad_documentnumber = '' then pch.pcc_number else '%' + :as_documentnumber + '%' end or
pch.dr_number = case when :ad_documentnumber = 0 then pch.dr_number else :ad_documentnumber end
) and
pcd.item_description like case when :as_itemdesc = '' then pcd.item_description else '%' + :as_itemdesc + '%' end



this is my query

View 3 Replies View Related

Power Pivot :: Rename Fieldname From Model To Different Presented Name For End User?

Jun 22, 2015

Is it possible to rename a field-name from ( tabular powerpivot ) model to a different Presented-name for the end user ?

usualy the names in the source model are Understandable to the developer , and its Custom to his understanding and nees , but for the end user its not - its not understandable , to long and so far form the regular terms in his Business , and also the language Might be non-English..

View 6 Replies View Related







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