SELECT statement Questions


In DB2 when a select statement is executed, it is taking lot of time and the table is being locked.
In DB2 when I’m giving a select statement its taking lot of time, the reason is like the table is a very huge table. As a result some times it is locking the table. Can any one help me for executing the select query with any option which would not lock the table. Thank you [...]

Answer Question   |  August 6, 2009  12:23 PM
DB2, DB2 query, SELECT statement
asked by:
80 pts.

SQL – Pass the result of the first query as the second query select column name
I want to pass the result of a sql query as the column name in another query eg. (note there will be a single result for the first query) SELECT CASE WHEN fld_type1 = ‘A’ THEN ‘VAL_ALPHA1′ WHEN fld_type1 = ‘D’ THEN ‘VAL_DATE1′ ELSE ‘VAL_NUM1′ END AS FIELDNAME FROM TABLE1 I want the result of [...]

Answer Question   |  March 25, 2009  11:07 AM
Dynamic SQL, SELECT statement, SQL
asked by:
25 pts.

Configuring SQL Server to not lock tables when using the SELECT statement
Is there a way to configure SQL Server to not lock tables where I am using the SELECT statement, so as to not have to writte “with NOLOCK” every time I use SELECT?

Answer Question   |  March 18, 2009  3:33 PM
SELECT statement, SQL Server, SQL Server tables
2,585 pts.

SQL View performance vs. SELECT
I am experiencing slow views on my database. If I create a view and run it, then use the same select statement from the view and run. They both return the same data, but View runs slower. My expectations was that since views are compiled, they should run faster. Could some one clearify this for [...]

Answer Question   |  June 8, 2010  7:22 AM
SELECT statement, SQL Server performance, SQL Server views
asked by:
5 pts.

How to retrieve, add and update data from SQL Server 2005 manually using VB.NET 2005?
Hey guys!!! I’m quite new to VB.NET 2005. I need to know how to add, update and retrieve data manually using VB.NET 2005. In the software which I’m trying to implement, data is entered in text boxes and then they are updated/added into an SQL table. When retrieving the data, for example: A student is [...]

Answer Question   |  March 9, 2009  11:01 AM
Data Junction, Extract Transform Load, INSERT statement, SELECT statement, SQL Server 2005, SQL Server connectivity, VB.NET 2005, Visual Basic .NET, Visual Basic 2005
asked by:
95 pts.

Oracle SQL-Pagination Help
Hi, The below inner SELECT returns huge amount of rows (1000000+) and the outer SELECTs(alpha BETWEEN #startRec# AND #endRec#) is used for PAGINATION to display data with 25 in each page. Issue is:-This PAGINATION done below is very slow and slows the entire display of data.So could all please help me on doing this below [...]

Answer Question   |  January 2, 2010  4:24 PM
Oracle SQL, Oracle SQL Pagination, Pagination, SELECT statement
asked by:
25 pts.

How to find a specific word in a SQL table
How do you write a SQL query to find a specific word in a SQL column. Example: I want to show all records that have the word Bob in it but do not want to include records that are Bobby or Bobble etc., only the exact word Bob. Hope that makes sense.

Answer Question   |  April 18, 2013  3:13 AM
SELECT statement, SQL, SQL Query, WHERE statement
asked by:
5 pts.

Pulling multiple values in the same line in SQL
Sorry if the title is a bit vague but its almost what am I trying to solve. The best way to explain my issue is this. If I have a table which takes the format.. user_id, error_code. (and other values also). The problem is that the same user_id is listed multiple times for each error_code [...]

Answer Question   |  February 6, 2009  1:22 AM
SELECT statement, SQL, SQL Query
asked by:
90 pts.

I am getting ORA-01422: Exact fetch returns more than requested number of rows
Hi experts, I am getting this error when I run my test case for my PL/SQL procedure, which has select and insert statements only. Not clear where I would have went wrong, Please guide me where should I check exactly. Its popping up with this error message which i caught in a exception piece after [...]

Answer Question   |  April 19, 2013  10:56 AM
INSERT statement, ORA-01422, Oracle development, Oracle error messages, PL/SQL error messages, SELECT statement
asked by:
610 pts.

PL/SQL: How to handle OUT Parameter during INSERT
HI Experts, I have a OUT parameter in my procedure(whihc performs INSERT data into a table),how to handle this OUT parameter (primary key of table) — Will Insert statement inside the PL/SQL block should include this parameter or we should use SELECT stm after Insert to add this attribute ,i am unclear on this please [...]

Answer Question   |  December 17, 2008  6:56 AM
INSERT statement, OUT parameters, PL/SQL, PL/SQL block, SELECT statement, SQL statements
asked by:
610 pts.

How to save the output from an SQL select statement to a spool file
Please can someone tell me how I can save the output from an SQL select statement to a spool file. Thanks, Tom

Answer Question   |  June 19, 2011  10:23 AM
SELECT statement, Spool files, Spool to Flat, SQL, SQL statements, Start Structured Query Language, STRSQL
asked by:
75 pts.

Conditional processing in embedded SQL
I’d like to conditionally control the host variable into which the data from an SQL select statement is retrieved. This is for flexibility, so that I can use the same code in my program more than once. Here is a code sample: C/EXEC SQL C+ If :ResultName = ‘AgtMaster’ C+ Then C+ Fetch Next From [...]

Answer Question   |  December 4, 2008  6:25 PM
Conditional expressions, Embedded SQL, SELECT statement, SQL
asked by:
Cwc
4,275 pts.

How can I join 3 tables using JOIN keyword
Hi Experts, Pls hlp me with my query How can i join 3 tables using JOIN Keyword inside PL/SQL block in SELECT … WHERE clause Query 3 Tables namely Reg,ROOTS,ME and the select statement takes both parameter variable and local variable Thanks!!!!!

Answer Question   |  December 8, 2008  6:20 AM
JOIN statement, PL/SQL, SELECT statement, SQL, SQL Query, WHERE statement
asked by:
610 pts.

Need SQL query
I have two tables DETAIL and USER. Detail table have two columns (projectid and projectdetail). Projectid is a primary key in DETAIL table. USER table have two columns (projectid and Userid). User table is like more than one userid can be under each projectid, one user can access more than one projectid. like the following [...]

Answer Question   |  January 15, 2009  10:29 AM
SELECT statement, SQL, SQL Query
asked by:
35 pts.

SQL select
SELECT obj.object_type FROM apps.opt_log_issue log, discov.opt_changed_database_objects obj WHERE –(UPPER(log.resolution(+)) like ‘%’||obj.object_name||’%’ – and trunc(log.resolution_date(+)) – trunc(to_date(substr(obj.last_ddl_time,1,11),’dd-mon-yy’)) <=5 – and trunc(log.resolution_date(+)) – trunc(to_date(substr(obj.last_ddl_time,1,11),’dd-mon-yy’)) >=0) OR (UPPER(log.resolution(+)) like ‘%’||obj.object_name||’%’ and log.resolution_date(+) is null) /

Answer Question   |  December 1, 2008  11:09 PM
Oracle development, Oracle SQL, SELECT statement, SQL Query, SQL statements, WHERE statement
asked by:
65 pts.

Advantages and disadvantages of certain SQL commands
Where can I find information about the advantages and disadvantages of using SQL commands like BCP, BULK INSERT, SELECT INTO, etc.?

Answer Question   |  November 19, 2008  3:08 PM
SELECT statement, SQL commands, SQL Server
2,585 pts.

SQL Server trigger , insert result of multiple where clause into a variable
Hi All, I have a select statement that stores the result in a variable,this works fine if there is only one condition and field in the clause.How do I go about it if there is more than one? For example (Working one) SELECT @Variable = (SELECT [Field] FROM [Table] WHERE [FIELD] = Value) But I [...]

Answer Question   |  November 12, 2008  8:23 AM
SELECT statement, SQL, SQL variables, Triggers
asked by:
20 pts.

Outputting results of SQL SELECT statements into a spreadsheet
I am using OPENROWSET to output the result of a number of SQL SELECT statements into a spreadsheet. It works for most of the SELECT statements, but there are 4 random queries out of 82 that take more than an hour to execute. This is the code: insert into OPENROWSET(‘Microsoft.Jet.OLEDB.4.0′, ‘Excel 8.0;Database=D:MGTempESWIConvAuditQueriescnvWriteOff.xls;’, ‘SELECT Phone, Member, [...]

Answer Question   |  November 7, 2008  8:54 PM
OPENROWSET, SELECT statement, SQL Server, SQL Server Query
2,585 pts.

How do I use the results of count(*)=0
I am using SQL to code a select statement. If the result of the statement = count(*)=0, I want to put a message out on a report.

Answer Question   |  November 10, 2008  11:18 AM
count(*)=0, SELECT statement, SQL
asked by:
85 pts.

Crystal Record selection
I need to eliminate duplicate records by comparing two fields, if the data is the same, I only want it to appear once. “Select Distinct” report option compares the complete record. Please help

Answer Question   |  October 30, 2008  5:22 PM
Crystal Reports, Crystal Reports Record, SELECT statement
asked by:
5 pts.