Say I have a table with a 'name' and 'quantity' columns, and I want to get the first X products which are the most present, and another line, which is the sum of all the other products.
We can take this sample SQL script as an example:
CREATE TEMPORARY TABLE product
(
name TEXT,
quantity INT
);
INSERT INTO product (name, quant...
Any way to do this? Replace function only replaces first instance.
Thanks.
...
Given the following tables:
Orders (OrderID, OrderStatus, OrderNumber)
OrderItems(OrderItemID, OrderID, ItemID, OrderItemStatus)
Orders: 2537 records
Order Items: 1319 records
I have created indexes on
Orders(OrderStatus)
OrderItems(OrderID)
OrderItems(OrderItemStatus)
I have the following SQL statement (generated by LinqToSql) ...
Hi
My Stored Procedure is using Bulk Insert Task. As per requirement of Bulk Insert, the text file should be on same server where database is.
Now file is residing on another machine. But database server can access file using shared network drive.
Now question is How my stored procedure can read or copy the file from network drive an...
Hi,
I'm developing a system that needs to accept sql queries dynamically. I'm looking for something where someone can define a select query in a file external to the system -- the system would execute the query and return the results as a DataSet. Then the system would read a mapping file (also defined external to the system) that woul...
How can I create a SQL user in a SQL Server Express database that I added to my project?
I need to create a user to use in a connection string that doesn't use Integrated Security.
...
We have a Family Hibernate Entity. This entity has(among others) 4 booleans properties. When retrieving the Families from the Postgres 8.4 DB, it is required that the List of families be ordered by sum of the boolean properties. There are 2 other fields in the order by criterion.
Eg
select fam.a, fam.b, fam.c, fam.d, fam.e
from family...
NOTE: I'm still looking for an answer that I can accept.
Hi,
I'm using a Sybase ASE database.
I have two tables that look like:
Table Shops:
---------------------
| ShopName | ShopID |
---------------------
| Sweetie | 1 |
| Candie | 2 |
| Sugarie | 3 |
---------------------
Table Sweets:
--------------------...
HI,
I have stored data & time as varchar type and data looks like this "9/16/2010 2:59:10 PM".
Now I want to retrieve data from between two dates such as From 01/01/2010 to 31/10/2010, When I run this SQL Statement:
SELECT username, timein, timeout
FROM user_log
WHERE (timein BETWEEN '01/01/2010' AND '30/11/2010')
It r...
I'm just a beginner in SQL Server database development and was wondering which authentication method to use. My database needs to have the simplest protection there is.
If I choose Windows authentication, what username and password do I pass when connecting to the database? What will happen when another user installs the application on ...
Let's say I have the Products table.
On my UI, I allow the user to search by name, description, code
The user can only search on criteria.
Should I create an index for each criteria : name, description, code
or create ONE single index for all 3?
What will make you choose one versus the other?
...
I have two tables.
The structure of tables is as follows.
TRAILERS_INVENTORY
TRAILER_TYPE VARCHAR2(100)
TRAILER_LENGTH INT
TRAILER_WIDTH INT
YEAR_OF_MANUFACTURE INT
NEW_INVENTORY
NEW_INVENTORY_TYPE_ID INT,
TRAILER_TYPE VARCHAR2(100),
TRAILER_LENGTH INT,
TRAILER_WIDTH INT,
YEAR_OF_MANUFACTURE INT
I want to list all of the trailer...
I have the following tables:
PERSON_T DISEASE_T DRUG_T
========= ========== ========
PERSON_ID DISEASE_ID DRUG_ID
GENDER PERSON_ID PERSON_ID
NAME DISEASE_START_DATE DRUG_START_DATE
DISEA...
Hello all,
I am trying to set up a few domain classes. I will explain it in english, and I am wondering how the domain would be set up in grails. Capitalized words are my domains
An Employee has an Education. An Employee has many Employer (past and present). An Employee had one or many Project for each Employer. Project have a Role, Cl...
I have an entity called Incident and a DTO called IncidentDTO. For now, IncidentDTO simply looks like this:
public class IncidentDTO : Incident
{
// empty until I can get AutoMapper working correctly
}
I'm trying to pull a list of all the Incidents in the database and convert them to DTOs using this code:
Mapper.CreateMap<Inciden...
I'm looking for a program that can take in an SQL string, (my environment is MySQL, but I could look at similar tools for other RDBMSs) parse it and render it again in a format that is more human-readable. I've seen some online ones, but I'm hoping for one that I can integrate into some internal logging tools.
For example, taking:
SELE...
I have a simple client-side Sqlite database (via. Google Gears) I want to use for persistence of the contents of a javascript object's properties (not methods). I don't really care about normalization since it has lots of potentially disparate fields (primitive types, arrays, objects) that would thwart normalization anyway.
What would ...
Vendor
(PK) - Id
Name
Stand
(PK) - Id
VendorId - fk - cascaded delete if Vendor is deleted)
Name
Item
(PK) - Id
VendorId - (fk - cascaded delete if Vendor is deleted)
Name
Price
UnavailableItem
(PK) - ItemId - (fk - cascaded delete if Item is deleted)
(PK) - StandId - (fk - cascaded delete if Stand is deleted)
The database above repr...
Currently I am performing a left join on two tables. The first table has an id and a persons name, the second table has an id, the id of a person from table 1, and then a timestamp (of the last flight they had).
People Flights
id | name id | person_id | time
------------ -----...
I am trying to run an update statement as follows...
UPDATE tblDeductionSystem
SET [ORDER] = [0RDER] + 6
WHERE [ORDER] >= 7
AND ScoringCriteriaTypeID = @CheerDeductionScoreSheetID
Sql Server if giving me invalid column name ORDER. I thought if I delimited the reserved word with the square brackets this would work.
...