Viewing 15 posts - 31 through 45 (of 921 total)
Is my table just set up wrong?
No, I just meant I wouldn't use EXISTS in a case like this. This is not an unusual type of query, and your...
--Jonathan
March 15, 2004 at 4:12 pm
I can't create a primary key on a calculated field
Yes, you can:
CREATE TABLE TestId(
Id int IDENTITY(0,1) NOT NULL,
FakeId AS ISNULL(Id%100,-1),
Dat datetime NOT NULL DEFAULT GETDATE(),
PRIMARY KEY(FakeId,Dat))
--Jonathan
March 15, 2004 at 2:09 pm
1)
DECLARE @t datetime
SET @t = GETDATE()
--first query here
PRINT DATEDIFF(ms,@t,GETDATE())
SET @t = GETDATE()
--second query here
PRINT DATEDIFF(ms,@t,GETDATE())
2)
I should study some basic SQL, your...
--Jonathan
March 15, 2004 at 1:25 pm
You may want to study some more basic SQL, as your new subquery used with EXISTS should of course be just:
(SELECT *
FROM dbo.tbl_MachineInstalls AS MIi WITH(NOLOCK)
WHERE MIi.MachineID = MIo.MachineID AND...
--Jonathan
March 15, 2004 at 12:24 pm
Your first and last queries are essentially the same, and I doubt the execution plans differ. When you're dealing with such short times, one second is probably within the margin...
--Jonathan
March 15, 2004 at 11:52 am
Well, you of course mean "TOP 100...ORDER BY DATE DESC". But what happens when you've got 150 rows and someone deletes rows 50-99? Your TOP query would then return 50 pairs...
--Jonathan
March 15, 2004 at 9:05 am
Actually, you should rethink this design. You are violating Codd's "Information Rule" by using the table identifier to convey information. This will lead to many more kludges like this. You...
--Jonathan
March 15, 2004 at 6:36 am
By moving the predicate from the join clause to the where clause, you are restricting the result set to just those rows satisfying the predicate, rather than including rows that...
--Jonathan
March 15, 2004 at 6:28 am
You can use DBCC CHECKIDENT (<TableName>, RESEED, 1) or just truncate the table.
--Jonathan
March 12, 2004 at 4:03 pm
1. How this binary store the information and why
CAST(1 as binary(1)) + cast(2 as binary(1)) is not equal to
CAST(2 as binary(1)) + cast(1 as binary(1))
which in my case...
--Jonathan
March 12, 2004 at 4:00 pm
Do you mean that you also want to ensure that there are no more than 100 rows in the table? And somehow re-use the numbers that were assigned to randomly...
--Jonathan
March 12, 2004 at 3:43 pm
Unless obscurantism and complexity are priorities, this seems like a quixotic exercise. Why not just use a binary(20) so you can at least decompose the thing later. That would allow for...
--Jonathan
March 12, 2004 at 3:04 pm
Well, obviously it makes a difference. ![]()
This issue has to do with the way the query optimizer works with a batch. The entire script...
--Jonathan
March 12, 2004 at 2:43 pm
Please explain how "up to 20 numbers within the range of 00 to 20" corresponds to a varchar(100) value of '1236547890-951736824-978645312-582963174'.
If you must "compare" the values "entered" by two "users," what...
--Jonathan
March 12, 2004 at 2:08 pm
You haven't posted the relevant information. Does this work for you?
use pubs
go
select top 0 * into #MyTable from authors
alter table #MyTable add constraint PK_MyTable...
--Jonathan
March 12, 2004 at 1:53 pm
Viewing 15 posts - 31 through 45 (of 921 total)