I have a large historical transaction table (15-20 million rows MANY columns) and a table with one row one column. The table with one row contains a date (last processing date) which will be used to pull the data in the trasaction table ('process_date').
Question: Should I inner join the 'process_date' table to the transaction table or...
I've a c# DataSet object with one table in it, and put some data in it and i've made some changes to that dataset (by code).
Is there a way to get the actual t-sql queries this dataset will perform on the sql server when I update the dataset to the database with code that looks something like this:
var dataAdapter = new SqlDataAdapter(...
I have a SQL table (MYSQL 4.0 to be precise) composed of the following :
int no (primary)
int field1
int field2
I would like to swap the values of field1 with the values of field2 and vice-versa.
Ex.: 1;2.5;3.76 becomes 1;3.76;2.5
I need a swapping temporary variable of some sort. But I don't think I can use something like
Set @va...
I am getting different results based on a filter condition in a query based on where I place the filter condition. My questions are:
Is there a technical difference
between these queries?
Is there anything in the SQL standard
that explains the different
recordsets from the queries?
Given the simplified scenario:
--Table: Parent Col...
hi,
I want to insert some data into a table
(id PK autoincrement, val)
with use multi insert
INSERT INTO tab (val) VALUES (1), (2), (3)
Is it possible to obtain a table of last inserted ids?
I'm asking becouse I'm not sure if all will in this form: (n, n+1, n+2).
I use mysql inodb.
...
Coming from a C background, I may be getting too anal about this and worrying unnecessarily about bits and bytes here.
Still, I cant help thinking how the data is actually stored and that if I choose an N which is easily factorizable into a power of 2, the database will be more efficient in how it packs data etc.
Using this "logic", I...
Possible Duplicate:
CONTINUE keyword in Oracle 10g PL/SQL
I am Using Oracle 9i and I want to use continue statement or its equivalent in PL/SQL. So is there any keyword called "continue" in oracle 9i. If not, please let me know the solution for this.
...
Can I somehow use a specific database given a specific condition? To clarify I will give a naive example:
CASE
WHEN @dbnum = 1 THEN USE Db1
ELSE USE DefaultDb
END
...
Suppose I have a massive table called inactiveUsers and a search form. I want to conditionally join the inactiveUsers table if any user related characteristic is chosen (address, name, phoneNumber, etc...). Is there any way to do this without the following:
<isNotEmpty property="address">JOIN inactiveUsers</isNotEmpty>
<isNotEmpty prope...
Is there some lib or function i can use to take my basic sql statement and transform the limit statement to a sql server compatible statement?
...
I have two separate tables both with user id columns uid. I want to take a value from all users in one table and insert it into the correct row for the correct user in the other table.
INSERT INTO users2 (picture)
SELECT pv.value
FROM profile_values as pv, users2 as u
WHERE pv.uid = u.uid
AND pv.fid = 31
AND users2.u...
I need to generate a list of users that are managers, or managers of managers, for company departments.
I have two tables; one details the departments and one contains the manager hierarchy (simplified):
CREATE TABLE [dbo].[Manager](
[ManagerId] [int],
[ParentManagerId] [int])
CREATE TABLE [dbo].[Department](
[DepartmentId] [int],
[Ma...
Hi,
I have a table which uses two columns to represent its primary key, a transaction id and then the sequence number.
I tried what was recommended http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#entity-mapping in section 2.2.3.2.2, but when I used the Hibernate session to commit this Entity object, it leav...
Hi,
There is a table Item like,
code,name
01,parent1
02,parent2
0101,child11
0102,child12
0201,child21
0202,child22
Create a java object and hbm xml to map the table.The Item.parent is a Item whose code is equal to the first two characters of its code :
class Item{
String code;
String name;
Item parent;
List<Item> ch...
I need to know how many records were returned in a select in oracle. Currently, I do two queries:
SELECT COUNT(ITEM_ID) FROM MY_ITEMS;
SELECT * FROM MY_ITEMS;
I need to know the COUNT but I hate doing two queries. Is there a way to do:
SELECT * FROM MY_ITEMS
and then find out how many records are in there?
...
I have a report that groups months by quarters, so each quarter has three months and the display of the months under the quarter is toggled by the quarter header.
It looks just fine in the ReportViewer, but when exporting to Excel the first month in the quarter with data is duplicated and appended to the end of the quarter group.
Her...
Hello,
I want to construct a SELECT statement with a conditional IF.
Like, IF there is no records with the language code 'Swedish':
SELECT * FROM Entries WHERE Language = 'Swedish'
THEN use 'English'
SELECT * FROM Entries WHERE Language = 'English'
How would I construct this statement using MSSQL?
Thanks,
Stefan
...
i am doing this:
delete from calibration_2009 where rowid in
(SELECT rowid FROM `qcvalues`.`batchinfo_2009` where reporttime like "%2010%");
i need to have about 250k rows deleted.
why does it take such a long time? is there a quicker way to do this?
...
Hi. I'm developing a simple database architecture in VisualParadigm and lately ran over next code excerpt.
IF EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'getType') AND type in (N'P', N'PC'))
DROP PROCEDURE getType;
Next goes my stored procedure:
CREATE PROCEDURE getType @typeId int
AS
SELECT * FROM type t WHERE ...
I have the following simple SQL statment
SELECT id, name, value_name, value_id
FROM table
GROUP BY id
ORDER BY value_id DESC
when grouping I would like to get the value_name and value_id of the tuple where the value_id is the biggest. The way it is i am getting the smallest value. For example
1, name1, valuename, 3 (where i know ...