Viewing 15 posts - 1 through 15 (of 27 total)
;WITH CTEs
AS (
SELECTO.ProductID,
O.OrderDate,
O.ProductClass,
O.ProductType,
DENSE_RANK() OVER (PARTITION BY O.ProductID,O.OrderDate,O.ProductClass,O.ProductType ORDER BY NEWID()) 'Duplicate'
FROMtmpEvalRecs R(NOLOCK) JOIN tmpOrders O(NOLOCK)
ON(R.recordid = O.recordid)
)
SELECT * FROM CTEs WHERE Duplicate > 1
Note:
= 1 (Single Occurance)
>1 (Multiple...
July 24, 2009 at 3:26 am
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='TABLENAME'
SELECT [NAME] FROM SYS.SYSCOLUMNS WHERE ID = OBJECT_ID('TABLENAME')
SELECT [NAME] FROM SYS.COLUMNS WHERE [OBJECT_ID] = OBJECT_ID('TABLENAME')
SP_COLUMNS 'TABLENAME'
July 23, 2009 at 1:22 am
According to MS BOL , OPTION Caluse will have QueryHint
query_hint ::=
{ { HASH | ORDER } GROUP
| { CONCAT | HASH | MERGE } UNION
...
July 23, 2009 at 1:00 am
DELETE MyTable FROM (SELECT IdentityColumn,DENSE_RANK() OVER(PARTITION BY ObjectId,DataKey ORDER BY NEWID()) 'Rank' FROM MyTable) MyTable1
WHERE MyTable.IdentityColumn =MyTable1.IdentityColumn
AND MyTable1.Rank > 1
July 1, 2009 at 3:12 am
SELECT 1 'Col1',col 'Col2' INTO tbDestination FROM tbSource
July 1, 2009 at 2:50 am
-- It will produce ServerName/Instance Name
SELECT HOST_NAME() 'Client Name',SERVERPROPERTY('SERVERNAME') 'DB Server Name'
--OR
-- It will produce ServerName
SELECT HOST_NAME() 'Client Name',SERVERPROPERTY('MACHINENAME') 'DB Server Name'
June 29, 2009 at 5:37 am
It might be Node level mismatch. change the value 1 to 2 and try...
[font="Verdana"]SELECT * FROM OPENXML (@idoc, '/ROOT/EVENT_INSTANCE',2)[/font]
June 26, 2009 at 8:03 am
According to MSDN specification....
ALTER INDEX cannot be used to repartition an index or move it to a different filegroup. This statement cannot be used to modify the index definition, such...
June 26, 2009 at 7:14 am
[font="Verdana"]Insert Into dbo.Apartment(apartmentID, apartmentDescID, apartmentNumber, apartmentFloorLevel, apartmentVacant)
Values(Default, ?, '22A', '2', 'Yes')
Insert Into dbo.Apartment(apartmentID, apartmentDescID, apartmentNumber, apartmentFloorLevel, apartmentVacant)
Values(Default, ?, '7', '1', 'Yes')
Insert Into dbo.Apartment(apartmentID, apartmentDescID, apartmentNumber, apartmentFloorLevel, apartmentVacant)
Values(Default, ?, '20', '2',...
June 25, 2009 at 5:02 am
[font="Verdana"]DECLARE @TABLE1TABLE (IDINT)
INSERT @TABLE1 VALUES(1)
INSERT @TABLE1 VALUES(2)
INSERT @TABLE1 VALUES(3)
INSERT @TABLE1 VALUES(4)
INSERT @TABLE1 VALUES(5)
DECLARE @IDsVARCHAR(MAX)
SELECT @IDs = COALESCE(@IDs,'') + CAST(ID AS VARCHAR) + ',' FROM @TABLE1
SELECT LEFT(@IDs,LEN(@IDs)-1) 'Result'
(OR)
;WITH CTEs(Result) AS (SELECT...
June 25, 2009 at 4:26 am
[font="Courier New"]DECLARE @s-2 VARCHAR(500)
DECLARE @X XML
SELECT @s-2='1,2,3,4,5'
SELECT @X = '<Data>' + REPLACE(@S,',','</Data><Data>') + '</Data>'
SELECT N.value('.','varchar(max)') 'Result' from @X.nodes('Data') as T(N)[/font]
June 25, 2009 at 3:11 am
It'll show SECOND & THIRD
;WITH CTEs
AS (SELECT Bldg,Job,DENSE_RANK() OVER(PARTITION BY Job ORDER BY NEWID()) 'Repeats' FROM #BuildingJob)
SELECT * FROM CTEs WHERE Repeats IN(2,3)
June 24, 2009 at 8:10 am
Try this....
Microsoft SQL Server 2005 --> Configuration Tools -->
SQL Server Configuration Manager -->
SQL Server 2005 Network Configuration --> Enable TCP-IP
June 24, 2009 at 1:07 am
Viewing 15 posts - 1 through 15 (of 27 total)