Viewing 15 posts - 31 through 45 (of 110 total)
Check this thread, you may get some ideas.
http://www.sqlservercentral.com/Forums/Topic624723-5-1.aspx#bm624760
September 9, 2010 at 11:19 am
I don't know storage. I just want to share my bad experience happened two years ago. it may not relate to your case.
At that time, we had a cluster SQL...
July 30, 2010 at 1:03 pm
Our company has a project about Government Health. In this project, Client asked to audit any changes against more than 20 tables. So we created triggers (insert, update,delete) to every...
July 30, 2010 at 12:29 pm
Ken McKelvey (4/1/2010)
SELECT T.UID, T.ReferenceNumber, T.Type
FROM myTable T
LEFT JOIN
(
SELECT DISTINCT T1.ReferenceNumber
FROM myTable T1
WHERE T1.ReferenceNumber NOT...
April 1, 2010 at 11:13 am
Ken McKelvey (4/1/2010)
SELECT UID, ReferenceNumber, Type
FROM myTable
WHERE ReferenceNumber NOT LIKE 'TR%'
AND Type = 1
UNION ALL
SELECT T.UID, T.ReferenceNumber, T.Type
FROM myTable T
WHERE T.ReferenceNumber NOT LIKE 'TR%'
...
April 1, 2010 at 8:51 am
here is execution plan
|--Merge Join(Inner Join, MERGE:([Union1010])=([T].[UID]), RESIDUAL:([SQLAdmin].[dbo].[Mytable].[UID] as [T].[UID]=[Union1010]))
|--Stream Aggregate(GROUP BY:([Union1010]))
| ...
April 1, 2010 at 8:50 am
Execution plan please?[/quote]
Because this is production sensitive data and company policy does not allow me to disclose this. I will build test table with full column list and post execution...
April 1, 2010 at 8:30 am
lmu92 (4/1/2010)
SELECT UID, ReferenceNumber, TYPE
FROM #tbl myTable
WHERE ReferenceNumber NOT LIKE 'TR%'
AND EXISTS (SELECT 1 FROM #tbl myTable2 WHERE TYPE = 1 AND...
April 1, 2010 at 8:22 am
Ken McKelvey (4/1/2010)
Try:
SELECT T.UID, T.ReferenceNumber, T.Type
FROM myTable T
WHERE T.ReferenceNumber NOT LIKE 'TR%'
AND
(
T.Type = 1
OR NOT EXISTS
(
SELECT *
FROM myTable T1
WHERE T1.ReferenceNumber = T.ReferenceNumber
AND T1.Type = 1
)
)
ORDER BY UID
Compared to my original...
April 1, 2010 at 8:05 am
GilaMonster (3/31/2010)
Please post complete table definitions, index definitions and execution plan, as per http://www.sqlservercentral.com/articles/SQLServerCentral/66909/Have you considered normalising that table?
CREATE NONCLUSTERED INDEX [IX_UID] ON [dbo].[myTable]
(
[UID] ASC
)
CREATE UNIQUE NONCLUSTERED INDEX [IX_ReferenceNumber]...
April 1, 2010 at 7:37 am
lmu92 (3/31/2010)
Reason:
With your first subquery you include all UIDs with Type...
April 1, 2010 at 7:28 am
Table structure
CREATE TABLE [dbo].[mytable](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[UID] [uniqueidentifier] NOT NULL,
[ReferenceNumber] [varchar](20) NULL,
[Type] [int] NOT NULL,
[Col4] [varchar](50) NOT NULL,
[Col5] [int] NOT NULL,
[Col6] [int] NULL,
[Col7] [uniqueidentifier] NULL,
[Col8] [int] NOT NULL,
[Col9] [varchar](max)...
March 31, 2010 at 1:21 pm
vidya_pande (3/31/2010)
select UID, ReferenceNumber, TypeFROM myTable
WHERE ReferenceNumber NOT LIKE 'TR%' AND
Type = 1
Is thi squery giving different results than yours one?
:w00t:
Yes. The result is different.
March 31, 2010 at 1:04 pm
I found the reason.
Our IT people cloned this server and built another brand new server. So all the server setting on new server is pointing to this server, including maintainence...
March 3, 2010 at 7:46 am
Hi,
Can anybody shed a light for me?
Yesterday, I deleted Maintainence plan for backup database including scheduled job.
And I disabled Integrity Check in scheduled job and removed Scheduled time on...
March 3, 2010 at 6:08 am
Viewing 15 posts - 31 through 45 (of 110 total)