Viewing 15 posts - 1,291 through 1,305 (of 2,171 total)
SELECT DATEADD(YEAR, DATEDIFF(YEAR, '19000101', CURRENT_TIMESTAMP), '19000101') AS theDate UNION ALL
SELECT DATEADD(YEAR, DATEDIFF(YEAR, '19010101', CURRENT_TIMESTAMP), '19000101') UNION ALL
SELECT DATEADD(YEAR, DATEDIFF(YEAR, '19020101', CURRENT_TIMESTAMP),...
September 19, 2007 at 2:48 am
The real question is "Why do you think you need a CTE for this?".
See http://www.sommarskog.se/dynamic_sql.html before you enter the land of denormalization.
September 18, 2007 at 2:43 am
See the difference between these two queries
SELECT CustomerID,
Item,
ActivationDate
FROM (
SELECT CustomerID,
Item,
ActivationDate,
ROW_NUMBER() OVER (PARTITION BY CustomerID, Item ORDER...
September 18, 2007 at 2:42 am
Try this
select customerId, item, min(activationDate) from history group by customerId, item
September 16, 2007 at 1:38 pm
How about 2 * LEN() because it NCHAR?
September 16, 2007 at 3:55 am
September 14, 2007 at 1:25 am
SELECT Name, Age FROM (
SELECT Name, Age, ROW_NUMBER() OVER (PARTITION BY Age ORDER BY Name) AS RecID FROM MyTab
) AS d WHERE RecID = 1
SELECT Age, MIN(Name)...
September 14, 2007 at 1:22 am
declare @sample table (custid int)
insert @sample
select 101 union all
select 101 union all
select 101...
September 13, 2007 at 2:40 am
DELETE f
FROM (SELECT ROW_NUMBER() OVER (PARTITION BY Col1 ORDER BY ID) AS RecID) AS f
WHERE RecID > 1
September 12, 2007 at 1:18 am
-- Initialize staging
BEGIN TRAN Yak
DECLARE @LastID INT
SELECT @LastID = MAX({Property table identity column name here})
September 12, 2007 at 1:11 am
For more versatile uses of DATEADD/DATEDIFF combinations, see
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=86769
September 11, 2007 at 12:44 am
Are you using SQL Server 2000 or SQL Server 2005?
September 11, 2007 at 12:42 am
Hi Ryan. Long time no see.
LEFT JOIN?
DECLARE
@Sample TABLE (ColA INT, ColB INT
September 10, 2007 at 1:09 pm
SELECT
DATEADD(MONTH, DATEDIFF(MONTH, 0,
September 10, 2007 at 4:42 am
The caveat is that only the first resultset is processed
SELECT
a.*
FROM OPENROWSET('SQLNCLI',
September 5, 2007 at 1:09 am
Viewing 15 posts - 1,291 through 1,305 (of 2,171 total)