SQL query question for SQL Swing Applet
Hi
I am building a little SQL Swing applet.
I was wondering if there is a SQL query statement to
find:
* The names of all the tables in the Database loaded.
* The number of tables in a database loaded.
Thank you very much in advance, A.
Not positive, but check out Connection.getMetaData(). It returns a DatabaseMetaData instance that has a number of get... methods that may provide the info you need.
Similar Messages
-
Hi
I am trying to figure out a SQL statement where I need to select all items if one meet a condition. In the example below I wan the query to return all 3 Red rows because one of the rows met condition = Bad.
Any help or pointer would be appreciated.
Thanks
Red Good
Red Bad
Red Good
Green Good
Green Good
Green Good
Blue Good
Blue Good
Blue GoodHi
Thank you for putting in t-SQL format.
One thing I struggling with:
If one of the Red is Bad, them make all 3 Reds Bad.
example
if one of the RED is bad:
Red Good
Red Bad
Red Good
then Update the three rows to this
Red
Bad
Red Bad
Red
Bad
I would appreciate any help on this. I tried converting one of the options you provided to update
select
Col1,Col2
from
test t Where
exists
(select
1
from
test Where
t.col1=col1
and
col2='Bad')
But the query keep returning syntax error
thanks -
Basic SQL query scripts for SAP B1
hi guys,
do you have any documents, guides or reference links regarding basic SQL query scripts for SAP B1?
thanks and have a nice day!
blake p.Hi
You can also check SBONotes.com.
For sql understanding , you can search in websearch - tsql and it will pop up with informations you need.
You can also refer to forum once you understand the basic techniques
Hope this helps
Bishal -
Re: How to converting from PL/SQL query to T-SQL query
How to converting from PL/SQL query to T-SQL query... Its Urgent
Download the
SQL Server Migration Assistant for Oracle. It will convert whole Oracle databases, or single queries or PL/SQL stored procedures.
With caution that If your database is using Collation which is case sensitive SSMA will not work.SSMA doesnt guarantees 100% for conversion of Queries/stored proc /database if it fails to do so for some queries you will have to do it manually.
But you can try
Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers -
Hi,
I'm purchasing SQL 2014 license.
Can I use the SQL 2014 license for SQL 2008 or 2012.
Thanks,
Sathish
SathishHi Sathish,
For more detailed information regarding to the license issue, please call 1-800-426-9400, Monday through Friday, 6:00 A.M. to 6:00 P.M. (Pacific Time) to speak directly to a Microsoft licensing specialist. For international customers, please use the
Guide to Worldwide Microsoft Licensing Sites to find contact information in your locations.
Regards,
Elvis Long
TechNet Community Support -
Sql query question - been trying for two days
Hi guys im trying to carry out an sql query
Im using a left join to do a query, which gives me a set of results:
select COURSESTUDENT.StudentNo, COURSESTUDENT.CourseCode, COURSESTUDENT.Year, MARKS.ExamMark, MARKS.EntryNo FROM COURSESTUDENT LEFT JOIN MARKS ON COURSESTUDENT.StudentNo=MARKS.StudentNo AND COURSESTUDENT.CourseCode=MARKS.CourseCode AND COURSESTUDENT.Year=MARKS.Year
but I would like to do a select on this result but do not want to use a create view as if more than one person access this page at a time then if the servlet tries to create the view an error will occur.
I would like to do the following select statement on the results of the query above..
select * from (above) where CourseCode='ELE304' AND Year=1999;
Is this possible, im using postgres..
Please help......
thanks
tzafSorry, I have never used postgres, but in several databases, the following syntax would work and provide the correct ResultSet.
select *
from (
SELECT
COURSESTUDENT.StudentNo,
COURSESTUDENT.CourseCode,
COURSESTUDENT.Year,
MARKS.ExamMark,
MARKS.EntryNo
FROM
COURSESTUDENT LEFT JOIN MARKS ON
COURSESTUDENT.StudentNo=MARKS.StudentNo AND
COURSESTUDENT.CourseCode=MARKS.CourseCode AND
COURSESTUDENT.Year=MARKS.Year
) A
WHERE
CourseCode='ELE304' AND
Year=1999 -
SQL Query error in java swing Application
hi,
I'm getting the following error when i try to manipulate the date in query.I have set of tuples and would like to retrieve with respect to the date given.Please do help me to get rid of this error.This is the error.
MY QUERY:
ResultSet rsdate=st1.executeQuery("select * from phy_stock where date = "+d1+"");
Where d1 is given like this:
String startdate[2]="11/31/2008";
DateFormat df = new SimpleDateFormat ("MM/dd/yyyy"); //converting a string to DATE format.
Date d1 = df.parse(startdate[2]);
ERROR:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'date = Mon Sep 01 00:00:00 IST 2008'
thanks,
kumar.Dates do not have formats. When referencing a Date in String concatenation, which is what you are doing here,
ResultSet rsdate=st1.executeQuery("select * from phy_stock where date = " + d1 + "");you will get what Date's toString method produces, which will not work for that (or any) query. For one, it wouldn't be surrounded by single quotes ('), and for two, the String format of the Date would not be acceptable by the DB (unless you had changed the DBs defaults).
Use a PreparedStatement, as suggessted above, and this problem goes away.
Edit: And make sure to use the setDate method, of course. -
Database - Show SQL Query question..
Greetings:
I am helping a co-worker with Crystal. I don't use crystal but I am able to explain the problem. My co worker is currently using crystal reports 8.5. If he pulls a query and the report is generated he can then click on Database menu then click on Show SQL Query. From there he is able to edit, add, remove fields. Now we want to place him on Crystal V10. When he does the same task, instead of being able to edit the Show SQL query he can only view it. Is there a way around this so that he can Edit the sql query in version 10 or did that feature go away in versions 9 and above. Also we are going to Purchase Crystal 2008, is this feature available in 08? Any help would be appreicated..Hi there!
I have the same problem as described above. I have been asked to figure out what is wrong with one of the reports that used to work when we used MAS 4.05. We are now on MAS 4.20 with Crystal Reports v.10 and the report fails to run. I loaded the report into Crystal to see if I could see the problem and I discovered that the report is still trying to access a table from the old MAS database. The SQL code as shown in the Show SQL Query window is as follows:
SELECT "AR_InvoiceHistoryHeader"."InvoiceNo", "AR_InvoiceHistoryDetail"."ItemCodeDesc", "AR_InvoiceHistoryDetail"."ItemCode", "AR_InvoiceHistoryDetail"."ExtensionAmt"
FROM "AR_InvoiceHistoryHeader" "AR_InvoiceHistoryHeader", "AR_InvoiceHistoryDetail" "AR_InvoiceHistoryDetail"
WHERE "AR_InvoiceHistoryHeader"."InvoiceNo"="AR_InvoiceHistoryDetail"."InvoiceNo" AND "AR_InvoiceHistoryHeader"."HeaderSeqNo"="AR_InvoiceHistoryDetail"."HeaderSeqNo" AND "AR_InvoiceHistoryHeader"."CommissionAmt"="AR_InvoiceHistoryDetail"."CommissionAmt" AND ARO_InvHistoryDetail."SOItemNumber" <> 'COMMENT' AND ARN_InvHistoryHeader."InvoiceDate" = {d '2007-09-21'}
ORDER BY "AR_InvoiceHistoryHeader"."InvoiceNo"
The problem is that ARN_InvHistoryHeader needs to be AR_InvoiceHistoryHeader and SOItemNumber needs to be ItemCode.
When I go into the Database Expert, I can only see the tables in the FROM clause. I don't know how to modify the WHERE clause. It kind of looks like this report was only partially converted to the new version. Is there a way to changed these attributes without rebuilding the whole report?
By the way, I apologize for not setting my SQL off in a code box, but I tried that and it caused the page to be very wide with no horizontal scroll bar.
Edited by: Jason Schill on Oct 27, 2008 11:30 PM -
SQL query statement for stored procedure / function listing ...
Hi everyone,
Is there a SQL query to list all the stored procedures and functions of an user in an Oracle 8 database?
I have this idea:
select * from USER_SOURCE where TYPE = 'PROCEDURE' or TYPE = 'FUNCTION'
but I am not too sure whether this is correct.
Thanks in advance,
EricYeah
I agree with you Garcia , my above posting was a correction to the query mentioned in the question only.
you are correct
If you only want the name of the object,
SELECT Object_Name from User_Objects where object_type in ( 'PROCEDURE' ,'FUNCTION');
is much faster than Selecting (distinct) from User_Source. -
hi all,
i created a report that displays results based on this query initially.
select *
from EMP
where 1=1;
i'm using a SQL Query (PL/SQL Function Body Returning SQL Query).
i have search items in my page like empno, lastname, firstname, middle, email_address etc... when i place a value for lastname then in my query it should add AND LASTNAME = :P1_LASTNAME.
so the query returned should now have
select *
from EMP
where 1=1
and LASTNAME = :P1_LASTNAME;
is this possible?
i was thinking something like looping for all search items in the page (ie. text, popup lov, datetimepicker) then check whether the item is null or not... when not null then probably get the substring of the item name like (ie. substr(:P1_LASTNAME) and get only LASTNAME then add "=" then concat it with the item name. not sure if this is possible though.
thanks
allenhi denes,
thanks for the sample... i noticed that the sample hard codes additional conditions to be added to the sql query which is okay when the search criteria is less than 5-10... but i'm thinking if the search criteria will be like 15-30 fields or make all fields searchable, this might be uncomfortable.
what i was thinking is like loop thru all the items i.e.
declare
sql varchar2(4000) := 'select * from emp where 1=1';
begin
for i in (select * from all_items_in_apex) -- this is just an example.
loop
if i.value is not null then
sql := sql || ' and ' || i.column || '=' || i.value;
end if;
end loop;
end;
the only thing is that i don't know if there's a possible replacement for the clause (select * from all_items_in_apex).
sorry if i'm asking too much but this is how i normally do it in forms. the suggestion in the link you provided should be sufficient but i was just wondering if this idea is also possible.
thanks again.
allen -
SQL Query constructing for searching values in Tables single Column
I have Table USER_SERVICES with 2 Columns USER_NAME, Services. Please find below sample data on USER_SERVICES Table.
A user can be assigned with multiple services(service1, service2 etc.,). So we store data as below :
USER_NAME Services
user1 service1
user1 service2
user1 service3
user2 service1
user2 service2
user3 service3
user4 service4
I need to frame a SQL Query to 'select users assigned with Service A and Service B and Service n'.
Note: 'And' condition is used when Searching for multiple services.
Example: The SQL Query has to dynamically handle condition if i give Single Service, multiple Services(service1 and service2 e.t.c,)
If i say select users assigned with service1 and service2, from the above Table, result should be user1 and user2
If i say select users assigned with service1 and service2 and service3, from the above Table, result should be user1
If i say select users assigned with service4 from the above table, result should be user4
If i say select users assigned with service1 from the above table, result should be user2,user1
If i say select users assigned with service1 and service2 from the above table, result should be user2,user1
How do i construct the SQL Query. Any help will be appreciated.
Thanks,
Sathish
Alternate email: [email protected]How it will be stored? In a string or a table or a collection type?
If you have it in a table you can do like this.
with t
as
select 'user1' user_name, 'service1' services from dual union all
select 'user1', 'service2' from dual union all
select 'user1', 'service3' from dual union all
select 'user2', 'service1' from dual union all
select 'user2', 'service2' from dual union all
select 'user3', 'service3' from dual union all
select 'user4', 'service4' from dual
t1 as
select 'service1' services from dual union all
select 'service2' from dual
select distinct user_name
from (
select t.user_name, t.services, t1.services, count(t1.services) over(partition by t.user_name) cnt, t1.cnt cnt_1
from t
left join (select t1.*, count(*) over() cnt from t1) t1 on t1.services = t.services
where cnt = cnt_1 -
I have an interesting problem and wondering how I can get this result in a single SQL query:
Here is table emp has data with a row for every year since the employee joined with the salary paid that particular year with following columns:
emp (
id varchar2(10),
name varchar2(25),
interested_year date,
salarypaid number(10)
I would like to print the results as follows:
id name previousyear_salarypaid currentyear_salarypaid
x xxxxx xxxxxx xxxxx
Is this possible to do? I have tried to simplify my actual problem so I hope I have included all necessary details.Just to clarify, the columns mentioned in the results are
previousyear_salarypaid is nothing but
salarypaid where interested_year = '2007'
currentyear_salarypaid is nothing but
salarypaid where interested_year = '2006' -
In my OBIEE development environment, a report I create in Answers generates the following SQL query to the database:
select T29323.LOCATION as c1,
T29323.TOOL_NAME as c2,
T29323.JOB_NUMBER as c3,
from
EDB.EDB_JOB_NUMBER_PARAMETER_T_V T29323
where
( T29323.JOB_NUMBER = 1319511
and T29323.CREATION_DATE <= TO_DATE('2008-05-21 08:38:18' , 'YYYY-MM-DD HH24:MI:SS')
and (T29323.LOCATION in ('MOO', 'RR'))
and T29323.CREATION_DATE >= TO_DATE('2008-05-18 08:38:18' , 'YYYY-MM-DD HH24:MI:SS'))
However, in my OBIEE Production environment the same report generates the following SQL query to the database;
select D1.c12 as c1,
D1.c11 as c2,
D1.c10 as c3
from
(select T29323.JOB_NUMBER as c10,
T29323.TOOL_NAME as c11,
T29323.LOCATION as c12
from
EDB.EDB_JOB_NUMBER_PARAMETER_T_V T29323
where ( T29323.JOB_NUMBER = 1319511
and T29323.CREATION_DATE <= TO_DATE('2008-05-21 09:19:03' , 'YYYY-MM-DD HH24:MI:SS')
and (T29323.LOCATION in ('MOO', 'RR'))
and T29323.CREATION_DATE >= TO_DATE('2008-05-18 09:19:03' , 'YYYY-MM-DD HH24:MI:SS'))
) D1
Any ideas why the queries are different? I have looked through my config files to see if a setting is different, but all are the same.
I am running OBIEE 10.1.3.3.2
Any suggestions would be appreciated.
Thanks,
KevinHi Kevin,
I have the same problem with generated SQL querys, I get different result with the same repository, same query in Answers, same OS... in several environments.
The BI vesion is 10.1.3.4
Any idea about the question?
Regards
Guillermo -
SQL-Query-Question: get all ID2 which have specific ID1
Hello,
I have a table Tab1 with millions of entries like
ID1 ID2
1 aa
4 aa
1 bb
4 cc
I'm looking for a sql-query which gives me all ID2-values which have a all of the supplied ID1, in the example above if I query for 1 4 then I want aa and not bb or cc because bb has only 1 and cc only 4.
The values of ID1 could be a lot like (1,2,3,5,7,8,9,10,34,4,67,33,53,43...).
Greetings
Stefanjust this
SELECT ID1,ID2
FROM Table t
WHERE EXISTS (SELECT 1
FROM Table
AND ID2 = t.ID2
HAVING COUNT(DISTINCT CASE WHEN ID1 IN (1,4) THEN ID1 ELSE NULL END) = 2
If you want you can pass values 1,4 through a parameter to make it generic like below
DECLARE @ValueList varchar(10)
SET @ValueList = '1,4'
SELECT ID1,ID2
FROM Table t
WHERE EXISTS (SELECT 1
FROM Table
WHERE ID2 = t.ID2
HAVING COUNT(DISTINCT CASE WHEN ',' + @ValueList + ',' LIKE '%,' + CAST(ID1 AS varchar(5)) + ',%' THEN ID1 END) = LEN(@ValueList) - LEN(REPLACE(@ValueList,',','')) + 1
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Need a SCCM SQL Query Report for Installed Software with Packages and Applications.
I need a report that will show the number of installs of all of the workstations applications and packages over a given period of time.
This will let us know how effective our deployments are and how well the on-demand software is being adopted.
Any help?Your Install Source might be an option as most SCCM deployments will install from C:\Windows\ccmcache\xx [where xx is a random folder name]. Most software vendors will put an install source in the registry, but not all do, so it won't be completely accurate.
When software is installed manually, the install source path won't be C:\Windows\ccmcache\xx.
Here is a SQL query I have for Install Source:
SELECT v_GS_COMPUTER_SYSTEM.Name0 as 'Computer Name', v_GS_INSTALLED_SOFTWARE.ProductName0 as 'Software Title', v_GS_INSTALLED_SOFTWARE.InstallSource0 as 'Install Source', v_GS_INSTALLED_SOFTWARE.ProductVersion0 as 'Version', v_GS_INSTALLED_SOFTWARE.InstalledLocation0
as 'Installed Location', v_GS_INSTALLED_SOFTWARE.InstallDate0 as 'Install Date'
FROM v_GS_COMPUTER_SYSTEM INNER JOIN v_GS_INSTALLED_SOFTWARE ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_INSTALLED_SOFTWARE.ResourceID
WHERE v_GS_INSTALLED_SOFTWARE.ProductName0 like '%Office 365 Pro%'
ORDER BY v_GS_COMPUTER_SYSTEM.Name0
Maybe you are looking for
-
Hi , Is it possible to call .htm files saved on disk - let's say c:\my_htmFiles on AppServer/DevSuiteServer using the web.show_document form's built-in...???? I have tried the following: web.show_document('c:\my_htmfiles\first.htm','_blank') and web.
-
SOLVED:Dmenu not launching correctly in Xmonad
I am running xmonad and I am having issues getting the dmenu_run to execute properly. It was working fine before but now it just launches with a white bar and nothing autocompletes. I am running Xmonad 0.9.2-2.1 and dmenu 4.4-1. Here is my entry in x
-
How to export AWM in Oracle 10g
Hi All, Im doing export of my Analytical Workspace with option tables=AW$TEST, this command failed and thrown EXP-00055: CALLDETAIL_TEST.AW$TEST is marked not exportable, i checked NOEXP$ table and i can find my AW name in it, according to table defi
-
Reader XI starts to open...displays EULA page momentarily and then gives problem message "Eula display has stopped working" and then shuts down. Have uninstalled twice and reinstalled without success. Windows 7 64 OS
-
I have just installed Snow Leopard 10.6.3 and want to update my Safari 4.0.4 to the latest version. However, the latest Safari version needs at least Snow Leopard 10.6.8. What can I do, please?