Viewing 15 posts - 16 through 30 (of 110 total)
DECLARE @Source TABLE (Id int, ServerName char(7), DateFrom datetime, DateTo datetime)
INSERT INTO @Source SELECT 1, 'APAXSG1', '01/01/2007', '01/31/2007'
UNION SELECT 2, 'APAXSG1', '01/15/2007', '02/15/2007'
UNION SELECT 3, 'APAXSG1', '02/01/2007',...
November 20, 2007 at 10:43 pm
UPDATE TableName
SET EndDate =
CASE
WHEN StartDate > '2003/01/01' THEN DATEADD(day, Days, StartDate)
WHEN StartDate < '2003/01/01' THEN ??? ((1/1/2003-1/1/2000)+1) is what date? why not add 10?
ELSE ???????? /* StartDate = '2003/01/01' */
END
November 15, 2007 at 2:19 am
search this forum on sp_MSforeachdb
November 5, 2007 at 10:15 pm
Although nothing is returned, your script generates no syntax (or any) error.
November 5, 2007 at 8:14 pm
Jeff Moden (10/31/2007)
Close! Not seeing StockCode 12 anywhere in the result, though...
SrockCode12 uses StockCode20.
So it is not shown.
I'm only displaying the lowest level item.
October 31, 2007 at 2:48 am
DECLARE @BOM TABLE (Product varchar(11), Part varchar(11))
INSERT INTO @BOM SELECT 'StockCode1', 'StockCode2'
UNION ALL SELECT 'StockCode1', 'StockCode3'
UNION ALL SELECT 'StockCode1', 'StockCode4'
UNION ALL SELECT 'StockCode1', 'StockCode5'
UNION ALL SELECT 'StockCode2', 'StockCode10'
UNION ALL SELECT...
October 30, 2007 at 7:41 pm
UNION will combine dupilcate result sets to a single set.
UNION ALL will produce the same result as the second query and performance will be similar.
October 30, 2007 at 6:52 pm
noeld (10/30/2007)
CREATE TABLE #tmp (EmpID INT , LocationID INT , Amount NUMERIC(9,2))
INSERT #tmp
SELECT 1, 1, 15.00 UNION ALL
...
October 30, 2007 at 6:26 pm
WITH Counts (EmpID, LocationID, Number) AS
(SELECT EmpID, LocationID, COUNT(*) FROM tblTransactions GROUP BY EmpID, LocationID)
SELECT A.EmpID,
(SELECT MAX(Z.LocationID) FROM Counts Z WHERE Z.EmpID = A.EmpID AND Z.Number = (SELECT MAX(Y.Number) FROM...
October 30, 2007 at 12:47 am
I think that the problem is the sequence of importing tables.
Referenced tables need to be imported before referencing tables can be.
October 24, 2007 at 1:09 am
DECLARE @a TABLE (Name char(4), Date datetime, ID int)
INSERT INTO @a SELECT 'mary', '10/01/2006', 1
UNION SELECT 'john', '10/13/2006', 2
UNION SELECT 'john', '12/17/2006', 2
UNION SELECT 'bob', '01/01/2006',...
October 23, 2007 at 10:03 pm
DECLARE @D datetime
SELECT @D = GETDATE()
SELECT DATEADD(day, - DAY(@D), @D)
September 10, 2007 at 3:53 am
It maybe that there are no ELSE parts in CASE statements.
September 9, 2007 at 6:26 pm
Viewing 15 posts - 16 through 30 (of 110 total)