I have a table with stock quotes
Symbol
Ask
Bid
QuoteDateTime
Using SQL Server 2008, lets say for any given 60 second time period I want to select quotes on all symbols so that there is a record for every second in that time period.
Problem is not every symbol has the same number of quotes - so there are some seconds that have no quo...
Hello,
im missing Backspace shortcut key from SQL MS 2005 for Up button in Object Explorer Details in 2008 version.
My Google can't find it :) so my question is:
Is there keyboard shortcut for Up button in Object Explorer Details in SQL 2008 Management Studio?
...
I'm developing in MVC2 using VB.NET and MySQL and ran into a problem trying to convert a simple SQL query to LINQ.
SQL Query:
SELECT Location_Number, sum(Column1) as totalC1, sum(Column2) as totalC2
FROM MyTable
WHERE year = 2010 and month = 8
GROUP BY Location_Number
ORDER BY Location_Number
LINQ Query:
From r In MyTable _
Where...
Is there a query I can do to find which tables have foreign keys on a given table? Our DBA does not believe in (or understand?) "ON DELETE CASCADE", so I when I delete something from a table, I want to make sure I delete all the dependent stuff first.
(Note, I don't need to find the tables programmatically, I can do that in SQL*Plus.)
...
While going through some SQL books I found that examples tend to use question marks (?) in their queries. What does it represent?
...
here are the 2 tables i have, i want to implement an trigger that customer cannot have more than 5 accounts from a one bank, but can have more than 5 in total.
CREATE TABLE ACCOUNT(
ACCOUNT_NO VARCHAR(20) NOT NULL,
BALANCE REAL,
BANK_CODE VARCHAR(20),
BRANCH_NO VARCHAR(25),
ACCOUNT_CODE VARCHAR(20),
PRIMARY KEY(ACCO...
Hi All,
I am new to sql. i have a small question. i have two tables as follows.
Table-A
Column-Key
87634799
98746323
Column-AwpUnitCost
2.3
4.0
Table-B
Column-Type
Missing
Invalid
Column-Destination
http://www.destination1.com
http://www.destination2.com
Table-A may have thousand records. AwpUnitCost may be positive,n...
I created 1 database with 2 file groups: 1 primary and 1 index.
Primary file group includes 1 data file (*.mdf): store all tables
Index file group includes 1 index file (*.ndf): store all indexes
Most of indexes are non-clustered indexes
After a short time using the database, the data file is 2GB but the index file is 12 GB. I do no...
I connect to a DB2 database and makes the following query. I don't understand why I get the error: "invalid cursor state".
public static void blivPar() {
try {
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
stmt.setM...
I am trying to create a delimitted string from the results of a query in DB2 on the iSeries (AS/400). I've done this in T-SQL, but can't find a way to do it here.
Here is my code in T-SQL. I'm looking for an equivelant in DB2.
DECLARE @a VARCHAR(1000)
SELECT @a = COALESCE(@a + ', ' + [Description], [Description])
FROM AP.Checkbooks
SEL...
How would i insert a number of rows into a table given an incremental range, with one column of the row containing the values?
...
I have a master table (hereafter called SURVEY) and a detail table (hereafter called ANSWERS.) Unsurprisingly, ANSWERS has answers to SURVEY questions. ANSWERS has a VARCHAR2 column named TEXT. Some ANSWERS.TEXT values are truly text but some are actually numerics. Fortunately, I always know which rows contain text and which contain ...
I have the following tables in a SQL Server 2008 db:
tblItem, which has an ItemID field;
tblGoodItem, which also has an ItemID field, and has a foreign key pointing to tblItem;
tblBadItem, which also has an ItemID field, and also has a foreign key pointing to tblItem.
An item cannot be both a good item and a bad item; it must either ...
I've never used TSQL before, but I decided I wanted to poke around in the SO data dump anyways. So this is probably a rookie question. I did try to search for an answer, but I don't know the technical term for what I'm trying to do, and search is only so good if you don't have the right keywords.
My goal is to find out how many question...
If I try to create a column whose value is a select returning more than one row, I get an error.
=> select (select 1 union select 2);
ERROR: more than one row returned by a subquery used as an expression
But if I create a function that does the same thing, I get the behavior I want.
=> create or replace function onetwo() returns set...
I have the following mysql table schema:
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `network`
--
-- --------------------------------------------------------
--
-- Table structure for table `contexts`
--
CREATE TABLE IF NOT EXISTS `contexts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`keyword` varchar(255) NOT NULL,
PRI...
I am trying to join 4 tables but having issues. my code is listed below.
The error I recieve is
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON advancedcatalog_font_type.id = advancedcatalog_dimensions.font_type_id) LEFT ' at line 6
adva...
Hi there,
I'm grouping some records by their proximity of time. What I do right now (timestamps in unixtime),
First off I do a sub select to grab records that are of interest of me,
(SELECT timestamp AS target_time FROM table WHERE something = cool) AS subselect
Then I want to look at the records that are close in time to those,
S...
Can anyone help me with this? I've read through http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-replication-connection.html and created a JBoss datasource with
<connection-url>jdbc:mysql:replication://sys1:3306,sys2:3306,sys3:3306/mydb</connection-url>
<driver-class>com.mysql.jdbc.ReplicationDriver</driver-class>
In my JB...
Have you encountered this exception for a stored procedure which does indeed have a balanced transaction block?
I double-checked the stored procedure and it has exactly one TRANSACTION BEGIN and cooresponding TRANSACTION END
Error logged
SqlException - Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT ...