SQL Questions


SQL for MS Access Syntex issue
I have started to read the book by Cecelia L. Allison and Neal A Berkowitz on SQL for Microsoft Access.  and there is a syntex listed below that has been giving me a problem.   I get an error with the word UNIQUE.  So I removed it from the statement and then I get an error with the [...]

Answer Question   |  February 3, 2010  1:56 PM
Microsoft Access, SQL
asked by:
1,185 pts.

Difficult Select Statement in SQL
I have a table with columns, to wit: FieldA FieldB A U B V C A C A C B D A D A D A E B E B E B I can get the records that are multiple in FieldA but whose values in FieldB are repeating with: Select FieldA, FieldB from table  [...]

Answer Question   |  February 3, 2010  2:22 AM
SQL, SQL Select, SQL Select statement problem
asked by:
560 pts.

Different results for embedded SQL
I have embedded SQL in my RPG code and some of the results are different to what I get when I check using STRSQL

Answer Question   |  February 1, 2010  7:08 PM
Embedded SQL, RPG, SQL, STRSQL
asked by:
20 pts.

Query Calculation Part of Select Criteria
This query works great except I need to add one thing. There are two district codes that need to be included in the query. These codes just need the MC_Tax_Amount field totaled – no dividing by two. How do I add this to my query? Thank you, SELECT “T16.CPRP”.CP_DISTRICT_CODE, SUM(“T16.CMCL”.MC_TAX_AMOUNT/2) AS TOWN , SUM(“T16.CMCL”.MC_TAX_AMOUNT/2) AS [...]

Answer Question   |  January 29, 2010  3:00 PM
iSeries Navigator, Query Calculation, SQL, Sql Script
asked by:
365 pts.

Why does the keyword END is not accepted at the end of a stored proc ?
Hey guys,  I have thise error in SQL stored proc.  I’m on ISERIES and I use RUNSQLSTM to very my procedure. could you help ?  It’s seem I can’t put a END at the end! ———————     160            AND DUDGCT = CDCODE                                              161            AND SUBSTRING(CDCEL3,1,4) = (                                    162      SELECT CLSTHE FROM [...]

Answer Question   |  January 26, 2010  9:03 PM
DB2, iSeries, SQL
asked by:
5 pts.

SQL transcation log file
Hi there, I developer is building a commercial application for me.  We are stuck at some point that we seem unable to deal with. The application being built is capable of dealing only with tables with primary keys.  We need it also to handle tables with no primary keys.  For clarity, we have no knowledge [...]

Answer Question   |  January 22, 2010  4:58 PM
Log files, SQL
asked by:
Yba
5 pts.

On the as/400 i series can one use SQL querys to update file
Cobol uses some kind od IKJ module user exit to allow DB2 SQL calls. I want to make a keyed read update one field and go on to the next record and do the same until end of file. Can do the same using RPG and if so could give me an idea what the [...]

Answer Question   |  January 20, 2010  9:55 PM
AS/400, RPGLE, SQL, SQL queries
asked by:
385 pts.

Simply, How do I populate Fields from a SQL Statement in Oracle Apex?
This is not a facitious question.  I am new to APEX.  I have looked over this stuff for weeks, but I can’t find a way to run an SQL statement and populate text boxes. I have tried the famous “For C1 in (Select…” but, when I put it into any of the areas, the event [...]

Answer Question   |  January 20, 2010  8:10 PM
Oracle Apex, PL/SQL, SQL, SQL statements
asked by:
20 pts.

Retrieve data from Oracle9i to SQL server
Currently my database client using SQL Server 2005 and there have another database whereby is using Oracle 9i, I wanted to retrieve the data from the oracle whereby query in SQL server 2005. 

Answer Question   |  January 20, 2010  10:42 AM
Oracle, Oracle 9i, Oracle SQL, SQL
asked by:
15 pts.

Can somebody provide me SQL questions based on various situation?
I have started working on SQL DB. During an interview question, there were various situations given through which we need to write some queries. Questions/ Situations where UNION , ORDERBY , JOINS , DATE Functions and others are used. Can somebody provide me SQL Join situation questions for practice .

Answer Question   |  May 10, 2013  10:15 AM
SQL, SQL Database, SQL queries
asked by:
295 pts.

as400 sql – non numeric data in numeric field
is there a function I can use to avoid and abend when sql hits a numeric field that contains non-numeric data. sql: select * from LPDtst/ARCOMB WHERE ACAOF# <0 Error: Selection error involving field ACAOF#.

Answer Question   |  January 20, 2010  11:23 PM
AS/400, AS/400 SQL, SQL
asked by:
75 pts.

View t-sql SPID is executing
Is there a table that I can query to view what sql statements a spid is running? I do not want to use the dbcc inputbuffer.

Answer Question   |  January 13, 2010  4:20 PM
SQL, SQL Server 2005
asked by:
585 pts.

SQL saving off data created to copy into new database
Data is created in one SQL DB for testing and then a new DB is created. Is there a way to save the data you need for testing in the new DB, so you don’t have to create it each and everytime for testing?? Any suggestions would bew appreciated.  Thanks…

Answer Question   |  January 12, 2010  3:34 PM
SQL, SQL Database
asked by:
25 pts.

result shoud be like that pls *****sal**** in sql
   select ENAME, sal, (LPAD(SA,(4,’*')RPD) IS NOT WORKING.  THE RESULT SHOULD BE LIKE THAT WY. ENAME, ***SAL****  THANKS.

Answer Question   |  August 8, 2010  7:01 PM
SQL
asked by:
5 pts.

sql what is TOSTMF
In SQL what is TOSTMF for an output file, and how do I use it?

Answer Question   |  January 5, 2010  6:34 PM
iSeries, SQL, TOSTMF
asked by:
15 pts.

Accessing an Access DB from Outlook via VBA
Hi The situation: In Outlook I get a message from a server. The content of the message needs to be put into an Access db. But, there may not exist another message with the same date. So, I need to look into a db if there is already a message with the same date and [...]

Answer Question   |  December 22, 2009  2:23 PM
Access, Outlook 2003, SQL, VBA
asked by:
50 pts.

Physical file over 600 000 000 records
Hi We have a Physical file which has more than 60 million records in it. In our application we search for the particular records based on 6 fields as a search criteria (web based) , search process are done in SQL Procedures. Even when i creatd a LF based on the mandatory search fields , we [...]

Answer Question   |  December 17, 2009  11:08 AM
AS/400 performance, Physical File, SQL
asked by:
10 pts.

embedded sql update
I have a prog that should update all KY cust master records with the new code AR. I run the program but nothing happens. The file remains unchanged. I am new to embedded sql so what am I doing wrong ?? D OLDWH           S              2    INZ(‘KY’)    D NEWWH           S              2    INZ(‘AR’)                                                        * Get all [...]

Answer Question   |  December 15, 2009  2:55 PM
Embedded SQL, RPGLE, SQL
asked by:
3,910 pts.

Link to file in IFS – file not found error.
To avoid sending very large SQL results through the email system I have created a command to place the file in the IFS and just send a link to the user via email. When I click on the link to open the file, it opens right up. When the users click the link, they get [...]

Answer Question   |  September 11, 2012  8:03 PM
IFS, IFS objects, SQL
asked by:
25 pts.

How to use the SQL update statement with a join to another file to get the correct selection
select count(op140m.pfpn) from prdat/op140m join cgoderi/op140mup ON op140m.PFCORP = op140mup.PFCORP and op140m.PFSTCN = op140mup.PFSTCN and op140m.PFPN = op140mup.PFPN and op140m.PFSTCN = p140mup.PFSTCN and op140m.PFEFDT = op140mup.PFEFDT I have 1 table op140mup with 8088 records and op140m with over 400000 records. I want to update 1 field in op140m but only for all based on the join [...]

Answer Question   |  December 11, 2009  10:51 AM
SQL, SQL/400
asked by:
30 pts.