I have the following table that records when a particular room in a hotel (designated by a three character code [dlx, sup, jac, etc..]) is sold out on a particular DATETIME.
CREATE TABLE [dbo].[RoomSoldOut](
[SoldOutID] [int] IDENTITY(1,1) NOT NULL,
[RoomType] [nchar](3) NOT NULL,
[SoldOutDate] [datetime] NOT NULL,
CONSTRAI...
How to select records between a date to another date given a DateTime field in a table....
...
I am still searching for a search engine to be used on my webhosting-providers server (one.com) and still haven't found any.
I have heard great things about Sphinx, what are the requirements to run it?
I have read the manual, doesn't say much, seems like it should work... Just want to ask some professionals first.
I dont have access t...
Say, I have two users (U1, U2) mapped to two resource pools (R1, R2) and with max values as 20% and 80%. U1 executes a time consuming query that runs for say 15 minutes. When it started execution it was the only process and hence SQL server allocates full resources to this query. 5 minutes later U2 executes another query. Will Resource G...
I have 4 tables: CustomerDocument, CustomerLink, CustomerAdditionalInfo, and CustomerImage. They each have a value of CustomerNumber, and I need to way to pull the customer numbers from each table and put in a drop down list. I know how to do it with one table, but not multiple. Also, there is a restriction that the CustomerNumber needs ...
My question is about how to write an SQL query to calculate the average time between successive events.
I have a small table:
event Name | Time
stage 1 | 10:01
stage 2 | 10:03
stage 3 | 10:06
stage 1 | 10:10
stage 2 | 10:15
stage 3 | 10:21
stage 1 | 10:22
stage 2 ...
Here's the situation. I have two tables:
users (registered users of the
website),
messages (personal messages they sent between each other)
The messages table has these columns (just the important ones):
id,
sender (id of user who sent the
message),
receiver id of user to whom
the message was sent),
reply_to (id of a message to ...
I have a trace table in the following format.
CREATE TABLE [dbo].[trace](
[trcId] [bigint] IDENTITY(1,1) NOT NULL,
[trcDateTime] [datetime] NULL,
[trcProgram] [nvarchar](150) NULL,
[trcCode] [nvarchar](8) NULL,
[trcText] [nvarchar](max) NULL,
[trcXML] [nvarchar](max) NULL,
[trcCorrGuid] [nvarchar](36) NULL, ...
I've recently been assigned the task of updating a "legacy" database (previously managed by an ex-coworker who left the company a while ago). The new database has the exact same structure as the previous one; the only difference is in the content itself, as this database now has more recent data.
The problem is that the old database ha...
I have a SQL script that is being executed in TOAD. Currently I have it laid out with just statement after statement, thusly:
select such-and-such from somewhere;
delete other-thing from somewhere-else;
And so on. Some of the where clauses end up being repetitive because I have complex inner queries to get particular IDs to operate...
I have two tables - Table1:
id name number
------------------
1 x1 123
2 x2 234
...and Table2:
tbl1id title rank
--------------------
1 t1 3
1 t2 2
2 t1 3
1 t3 1
Is there a way I can join them to return result as showing max title based on min rank for given user:
id name ...
how can i select 12/20/2008 in where clause of sql.
it is sql server 2005.
select * from tblErrorLog
where errorDate = '12/20/2008'
...
I have a table that I want to add a bit column, which I wish to default to false for all existing data.
How do I alter my table in such a way that it allows me to specify NOT NULL before I have inserted false for my existing rows?
Should I create it as nullable, do an insert than switch it non-nullable?
...
I've look around and I haven't find anything in the Web pointing me to the right direction, so I'll try the knowledgeable stackoverflow people :)
I have 4 tables in Microsoft Access 2007 (Warehouse, Cars, TVs, Toys).
__(many) Cars
/
Warehouse 1---(many) TVs
\__(many) Toys
The Warehouse table has a 1...
Say you have table of some items with these two columns:
ItemName
Price
....where ItemName is unique.
How do you show sum of all prices for every ItemName (I'm using Oracle)? If I just try this:
SELECT ItemName,
SUM(Price)
FROM Items
I get this error:
ORA-00937: not a single-group group
function
...which goes a...
Can someone help giving me some direction to tackle a scenario like this.
A User table which contains all the user information, UserID is the primary key on User Table. I have another table called for example Comments, which holds all the comments created by any user. Comments table contains UserID as the foreign key. Now i have to rank...
I am getting the error "Procedure sp_Get-- has no parameters and arguments were supplied".
I am calling a simple stored-proc from a CF component.
The Stored proc is as follows
GO ALTER PROCEDURE [dbo].[sp_GetTest]
@TestId INT AS BEGIN
SET NOCOUNT ON;
SELECT T.TestId
,T.TestDetail
,T.isPassedTest
FROM Te...
Hello guys, I wrote a statement that takes almost an hour to run so I am asking help so I can get to do this faster. So here we go:
I am making an inner join of two tables :
I have many time intervals represented by intervals and i want to get measure datas from measures only within those intervals.
intervals: has two columns, one i...
I have the following SQL query....
select AanID as '@name', '<![CDATA[' + Answer + ']]>' from AuditAnswers for XML PATH('str'), ROOT('root')
which works wonderfully but the column 'Answer' can sometimes have HTML markup in it. The query automatically escapes this HTML from the 'Answer' column in the generated XML. I don't want that....
Hello!
My client currently scans invoices and similar documents into PDF format, and stores them in the file system. I suggested to him that we store the scans in their custom management system's SQL Server to remove one of the 'moving parts' of their system.
My original idea was to store them in a lossless graphics format, but the ac...