Is it possible to order the result of select query on a db2 database case insensitively?
For example:
I want to have all names that start with an "a" or "A" sorted together.
Abraham
aron
andrea
Annica
brian
Benjamin
Now it's like this:
aron
andrea
brian
Abraham
Annica
Benjamin
...
I have bound a ListBox to a SQL CE database with this code:
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:DatabaseWindow}}, Path=Database.Photos1}"
This ListBox is populated properly. But when I try to insert a row into the database (InsertOnSubmit + SubmitChagnes), the ListBox is not up...
Let A and B be two tables in a database schema. A and B are related by a many-to-one relationship. There exists many B's for each A, and B has a foreign key column a_id. Both tables have a primary key column id.
Which of the following two queries performs better for large data sets in A and B?
SELECT A.* FROM A,B WHERE A.id = B.a_id...
I need to saving strings in database. Each string has different size from 1 to N. I think that limit will be about 10000, maybe more. nvarchar(MAX) will be best way to resolve this ?
...
Hi,
With sql Server 2005.
I have declared a trigger that get fired "AFTER INSERT, UPDATE" , in this trigger I'm using a WHILE and a CURSOR to loop on the INSERTED table's rows.
When I find a row that does not sotisfy a specific condition:
I want the trigger to rise an error and do not insert any of the rows that fired the trigger (not e...
I need to look up thousands of rows by ID, but the IDs come from outside the DB, so I can't get them from other tables like so:
SELECT * FROM some_table WHERE ID IN (
SELECT KnownID FROM some_other_table WHERE someCondition
)
Is there anything better than this:
SELECT * FROM some_table WHERE ID IN ('1001', '1002', '1003...
I've got a complex SQL where clause that just got more complex because of a requirements change. There are four basic sets of cases, each with a different combination of other factors. It's more readable (in my opinion) to have the four cases as separate branches of the where clause, and to repeat the redundant criteria in each branch. B...
Anyone know a simple query to grab a list of all stored procedures in a SQL 2005 database ordered by createdate?
...
I'm trying to programmatically add an identity column to a table Employees. Not sure what I'm doing wrong with my syntax.
ALTER TABLE Employees
ADD COLUMN EmployeeID int NOT NULL IDENTITY (1, 1)
ALTER TABLE Employees ADD CONSTRAINT
PK_Employees PRIMARY KEY CLUSTERED
(
EmployeeID
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP...
I have a table like so:
Fiscal Year, Region, Country, Office1, Office2, Office3, Office4
Where office 1-4 are foreign keys.
I would like to get output like so:
Office 1: Fiscal Year, Region, Country
Office 2: Fiscal Year, Region, Country
Office 3: Fiscal Year, Region, Country
Office 4: Fiscal Year, Region, Country
Can this be done usi...
I have a primary key that I don't want to auto increment (for various reasons) and so I'm looking for a way to simply increment that field when I INSERT. By simply, I mean without stored procedures and without triggers, so just a series of SQL commands (preferably one command).
Here is what I have tried thus far:
BEGIN TRAN
INSERT INT...
I have a simple SQL table which has a DateTime column. I would like to update all the rows (>100000 rows) with a random date. Is there a simple way to do this a SQL Query?
...
TSQL (as used in MS SQL Server 2000 and 2005) allows multiple JOIN clauses, one right after the other, no commas or parentheses needed. Try this in Access and it throws a fit:
"Syntax error (missing operator) in query expression ... "
From what I have been able to gather out in Google-land, Access SQL wants parentheses to group the JOIN...
We've run across a slightly odd situation. Basically there are two tables in one of our databases that are fed tons and tons of logging info we don't need or care about. Partially because of this we're running out of disk space.
I'm trying to clean out the tables, but it's taking forever (there are still 57,000,000+ records after lett...
How do we insert data about 2 million rows into a oracle database table where we have many indexes on it?
I know that one option is disabling index and then inserting the data. Can anyone tell me what r the other options?
...
I've created composite indexes (indices for you mathematical folk) on tables before with an assumption of how they worked. I was just curious if my assumption is correct or not.
I assume that when you list the order of columns for the index, you are also specifying how the indexes will be grouped. For instance, if you have columns a, b,...
I have a SQL 2005 Reporting Services report that has several report parameters. One of them is called IsActive and is of type Boolean. The parameter is hidden and set to allow null values. For its default values settings, I have it set to null. In my application that has the reportviewer control, I have logic that decided whether or ...
I'm trying to get a product's name and its number of sales from two separate tables.
My tables look something like this:
BOOK
Book_ID | Book_Title | Book_Author
SOLD
Transaction_ID | Book_ID | Customer_ID
I can get most of the results I want from the following query
SELECT b.Book_Title, COUNT(s.Book_ID) FROM Book b, Sold s
W...
For example I've often wanted to search stackoverflow with
SELECT whatever FROM questions WHERE
views * N + votes * M > answers AND NOT(answered) ORDER BY views;
or something like that.
Is there any reasonable way to allow users to use SQL as a search/filter language?
I see a few problems with it:
Accessing/changing stuff (a c...
I am working off this example.
http://www.drury.net.nz/2005/04/15/specifying-a-sort-parameter-for-a-tsql-stored-procedure/
CREATE PROCEDURE getEmployees ( @ColumnName varchar(100) )
AS
SELECT
EmployeeID,
FirstName,
LastName,
SSN,
Salary
FROM
Employees
ORDER BY
CASE
WHEN @ColumnName=’...