When executing:
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
SELECT 1;
END;
DECLARE EXIT HANDLER FOR SQLWARNING
BEGIN
ROLLBACK;
SELECT 1;
END;
-- delete all users in the main profile table that are in the MaineU18 by email address
DELETE FROM ap_form_1 WHERE element_5 ...
What do you put in a subquery's Select part when it's preceded by Exists?
Select *
From some_table
Where Exists (Select 1
From some_other_table
Where some_condition )
I usually use 1, I used to put * but realized it could add some useless overhead.
What do you put? is there a more efficient wa...
I am working on a SQL Job which involves processing around 75000 records.
Now, the job works fine for 10000/20000 records with speed of around 500/min. After around 20000 records, execution just dies. It loads around 3000 records every 30 mins and stays at similar speed.
I asked a similar question yesterday and got few good suggestions...
I'm working with a medical-record system that stores data in a construct that resembles a spreadsheet--date/time in column headers, measurements (e.g. physician name, Rh, blood type) in first column of each row, and a value in the intersecting cell. Reports that are based on this construct often require 10 or more of these measures to b...
I wasn't sure if it recounted the rows, or if after it retrieved the whole result set, it only grabbed the total post query?
...
I'm trying to select all dates that haven't pass the current date. So for instance, I want to display every date after 2009-10-06 and NOT dates prior 2009-10-06.
...
I would like to create a view that has a single column. If my two tables looked like the following:
Table 1:
ID | Name
1 | Joe
Table 2:
ID | Address
1 | 123 BlueBerry St.
The view would look like:
View:
newcolumn |
Joe
123 Blueberry St.
The reason I do this is because I have an autocomplete text box that searchs a single colum...
I'm just curious to know why SQL IsNumeric() returns int instead of bit? Seems like it should return a bit.
...
Application connected to MS SQL Server will create views where a single row result is an analysis including aggregations of 1-10k records. The applicable criteria across the resulting view will have dozens to tens of thousands of results. The view+criteria will then be ordered by some column (user specified) in the view which are most li...
There is a functionality in Oracle which permits to use a number in parentheses instead of naming a field to order a result. Example : this query order the result by the "id" column :
select name, id
from table
order by (2)
What is the name of this functionality and where can I can read documentation on it ?
...
What are the different SQL Server 2008 data types?
I am specifically trying to find the equivalent of a long int.
...
How do SQL Server View Indexes work under the hood? I've read this TechNet article but it doesn't explain how a view index actually works. Can anyone explain this to me?
Note: I'm not sure if this should have gone on SF. If it should, just move it over there.
...
Hi,
I have a SQL server 2000 and an Access database mdb connected by Linked server on the other hand I have a program in c # that updates data in a SQL table (Users) based data base access.
When running my program returns the following error message:
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. Authentication failed.
[...
I was trying to execute this mysql query it is not giving me any results if i set the query_limit to more than 100, can somebody point me what i can do to get this working for fetching more data.
$query_limit = 190;
$query1 = "SELECT N.nid ,N.tid FROM term_node N JOIN term_data S ON S.tid = N.tid AND S.vid =1";
$query_result = db_quer...
Please bear with me new to SQL- I am trying to write an SQL command with a join in a PROGRESS db. I would like to then select only the first matching record from the join. I thought to use LIMIT but PROGRESS does not support that. MIN or TOP would also work I think but having trouble with the syntax.
Something like this?-
SELECT table1....
I have a database for which I need to aggregate records into another smaller set. This result set should contain the difference between maximum and minumum of specific columns of the original records where they add up to certain SUM, a closed interval constant C.
The constant C determines how the original records are aggregated and no ...
Please bear with me new to SQL- I am trying to write an SQL command with a join in a PROGRESS db. I would like to then select only the first matching record from the join. I thought to use LIMIT but PROGRESS does not support that. MIN or TOP would also work I think but having trouble with the syntax. Here is current syntax:
SELECT esth...
It sounds like an odd one but it's a really simple idea. I'm trying to make a simple Flickr for a website I'm building. This specific problem comes when I want to show a single photo (from my Photo model) on the page but I also want to show the image before it in the stream and the image after it.
If I were only sorting these streams by...
I have a sql statement with multiple left joins that I cannot get to work in Access 2007, the message stating,
JOIN expression not supported
SELECT
Foo.A,
Bar.B,
Baz.C,
Bat.D
FROM
Foo
LEFT JOIN
Bar ON Foo.BarId = Bar.BarId
LEFT JOIN
Baz ON Foo.BazId = Baz.BazId
LEFT JOIN
Bat ON Foo.BatId = Bat.BatId
WHERE
Foo.Cr...
The DDL creates the schema and data. I am looking for a where statement where it returns only one row for each ID and that row would be the last inserted row based on the inserteddate column.
So the result would be John, 5 and Debbie, 5
select Table1.Name, Table2.Rating
From table1 join table2 on table1.ID = table2.ID
where inserteddat...