473,394 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

SQL - Select ALL rows

I have an SQL statement which relies on a numeric value

e.g.

where id = 6

I am using a BI tool which let's me pass in the id to the report
dynamically however, I want to be able to pass "ALL" or similar to
return all rows.

Is there some type of wilcard expression I can use in SQL on the
fly???

e.g.

where id = *

Thanks

May 31 '07 #1
7 5589
Remove the predicate....
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 31 '07 #2
On May 31, 9:18 pm, Serge Rielau <srie...@ca.ibm.comwrote:
Remove the predicate....
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
If I was able to I would have and wouldn't have posted this thread!!!!

I CAN'T remove the predicate!!! Can I or can I not use a wildcard on
the fly?

May 31 '07 #3
whitsey wrote:
I have an SQL statement which relies on a numeric value

e.g.

where id = 6

I am using a BI tool which let's me pass in the id to the report
dynamically however, I want to be able to pass "ALL" or similar to
return all rows.

Is there some type of wilcard expression I can use in SQL on the
fly???

e.g.

where id = *

Thanks
What about

where id = id

Can you manage that ?

Phil
May 31 '07 #4
I CAN'T remove the predicate!!! Can I or can I not use a wildcard on
the fly?
You cannot. Forgive me, your questions are fairly basic. It is non
obvious what you do or do not know, or can and cannot do.

You BI tool should have an option to generate the predicate.
It's a pretty basic capability.
If you tell users what tool you are using and what you try to achieve
(on a higher level) they may be able to advise.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 31 '07 #5
Serge Rielau wrote:
>I CAN'T remove the predicate!!! Can I or can I not use a wildcard on the fly?
You BI tool should have an option to generate the predicate. It's a pretty basic capability.
Hmm... Not so simple. BI tool and automatic report generators are the real piece of junk :)

For example, you may be required to create and maintain two separate reports:

* with predicate 'id = ?'
* without this predicate

The reports, otherwise identical...
Sometimes, you can't even copy report and change sql statement without complete redesign of report.
In that case so crappy workaround may appear:

WHEN ((1 = ?) OR (id = ?))

to switch predicate 'id = ?' on and off on the fly...
--
Konstantin Andreev.
May 31 '07 #6
What we have seen tools do is this:
WHERE 1=1
Then any extra predicate gets glued on using 'AND ID = ? ' etc...
That is less harmful.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 31 '07 #7
On Jun 1, 1:19 am, Serge Rielau <srie...@ca.ibm.comwrote:
What we have seen tools do is this:
WHERE 1=1
Then any extra predicate gets glued on using 'AND ID = ? ' etc...
That is less harmful.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Thanks Guys,

In the end I had to create two separate statements, one with and one
without.
I'm meeting with the BI tool company today (LogiXML) and will ask them
their suggestion.

Cheers

May 31 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: informatico | last post by:
Hi there. I'm not well-versed in MS Access, but I've been reading the documentation to no avail to find a way to solve what seems to me a rather simple issue. I have a query containing two...
0
by: WhiteWizard | last post by:
I am trying to implement standard multi-select of rows in a datagrid. That is, allow the user to use the CTRL & SHIFT keys to select multiple rows in a datagrid. Then I'll loop through them and...
4
by: bizt | last post by:
Hi, I want to find an easy way to select only rows within a certain range when I do a select. Im sure I have seen this done with a SELECT statement but cant remember if or how it was done. Can...
0
by: =?Utf-8?B?U3RldmU=?= | last post by:
C# I have a datagrid, and the users are able to select multiple rows and perform an action. This works fine, as I get the rows selected using something like this: CurrencyManager xCM =...
1
by: khairulfnd | last post by:
i wanna know the function when u select rows in the datagrid, it will be postback to a gridview where should i put it
1
by: WWUser | last post by:
I have an Excel workbook where data of a particular type is separated by "header" rows using colons to specify the data type: :DataType1 FirstDataPoint SecondDataPoint ThirdDataPoint...
0
by: ArvisLT | last post by:
Hi, I'm trying to make SQL query which selects data dependent on current ASP user and his being in user groups. I have tables: AspNet_Users – contains UserName and UserID columns AspNet_Roles –...
2
by: sladjana21 | last post by:
Hello, is it possible to select rows form a table, where column with datetime is null, something like: SELECT * FROM MYTABLE WHERE DATE_COLUMN = NULL there is no error, but doesn't return any...
22
by: chromis | last post by:
Hi, I'm trying to display a table of highscores, but I don't want to display more than one highscore from the same person aka duplicates in the name column. I tryed this: $sql = "SELECT...
2
by: sandeep.iitk | last post by:
Hi Serge, Please provide a link related to OLAP expressions. it will be a gr8 help. Thanks Sandy
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.