Viewing 15 posts - 856 through 870 (of 2,171 total)
For performance, yes. But SQL Server takes care of the filtering for you.
See this picture. This is the execution plan when having Status = 2 in the WHERE statement.
A nice...
June 12, 2008 at 7:12 am
When you update the status, the SQL Server automatically rearrange the records to the correct table/partition.
See the execution plans in the link above.
June 12, 2008 at 4:17 am
Thank you for your feedback.
I think this can be done with 12 insert statements (one for each source table to archive target table).
You can process all records for a table...
June 12, 2008 at 3:07 am
See if this blog post about horizontal partitioning helps you
http://weblogs.sqlteam.com/peterl/archive/2007/09/24/Horizontal-partitioning.aspx
You can do the same with your data.
Have a composite key with a new column named "HighProfileProject" which is 1...
June 12, 2008 at 1:24 am
I accept your apologize. I believe you are sincere about it.
As for the original question, we don't really know what the loop/cursor is for, do we?
All we know is that...
June 11, 2008 at 10:10 pm
sharma (6/11/2008)
Hi How the format file would be for above ?
Since we don't know your column name nor the file layout you will have to do some work for yourself...
June 11, 2008 at 9:03 am
I use table variable just for convenience.
You can use temp tables as well.
SET NOCOUNT ON
CREATE TABLE#Sample
(
i INT,
Done TINYINT
)
INSERT#Sample
SELECT1, 0 UNION ALL
SELECT2, 1 UNION ALL
SELECT3, 0
DECLARE @i INT
SELECT@i = MIN(i)
FROM#Sample
WHEREDone =...
June 11, 2008 at 8:58 am
I believe you are wrong Sergiy, again.
SET NOCOUNT ON
DECLARE@Sample TABLE (i INT, Done TINYINT)
INSERT@Sample
SELECT1, 0 UNION ALL
SELECT2, 1 UNION ALL
SELECT3, 0
DECLARE @i INT
SELECT@i = MIN(i)
FROM@Sample
WHEREDone = 0
WHILE @i IS NOT...
June 11, 2008 at 8:34 am
DECLARE @PNo NUMERIC(10,0)
SELECT@PNo = MIN(PNo)
FROMPT
WHEREPDone = 0
WHILE @PNo IS NOT NULL
BEGIN
...
UPDATEPT
SETPDone = 1
WHEREPNo = @PNo
SELECT@PNo = MIN(PT)
FROMPT
WHEREPDone = 0
END
June 11, 2008 at 7:49 am
DECLARE @PNo NUMERIC(10,0),
@Counter INT,
@CounterMAX INT
CREATE TABLE#PT
(
RowNum INT IDENTITY(1, 1) PRIMARY KEY,
PT DATETIME,
PNo NUMERIC(10,0),
PVer NUMERIC(2,0),
PAction CHAR(1),
PDone BIT
)
INSERT#PT
(
PT,
PNo,
PVer,
PAction,
...
June 11, 2008 at 7:46 am
Books Online says you should use a format file, so I would try that first.
Or simply
INSERT TargetTable (Col1, Col2, Col3, Col4)
SELECT ColBlue, ColGreen, ColRed, ColWhite
FROM OPENROWSET (....) AS c
June 11, 2008 at 5:32 am
CREATE FUNCTIONdbo.fnWeekDiff
(
@Date1 DATETIME,
@Date2 DATETIME
)
RETURNS INT
AS
BEGIN
RETURN1 + ABS(DATEDIFF(DAY, '19000101', @Date1) / 7 - DATEDIFF(DAY, '19000101', @Date2) / 7)
END
GO
DECLARE@Date1 DATETIME,
@Date2 DATETIME
SELECT@Date1 = '20080602',
@Date2 = '20080608'
SELECTdbo.fnWeekDiff(@Date1, @Date2),
dbo.fnWeekDiff(@Date2, @Date1)
June 10, 2008 at 6:15 am
SELECT REPLACE(CONVERT(CHAR(11), GETDATE(), 106), ' ', '-')
June 10, 2008 at 6:07 am
June 10, 2008 at 12:27 am
Viewing 15 posts - 856 through 870 (of 2,171 total)