This seems to work:
DECLARE @pricetable TABLE (sym VARCHAR(10), pricedate DATETIME, price INT)
INSERT INTO @pricetable (sym, pricedate, price) VALUES('msft', '1/2/9', 33)
INSERT INTO @pricetable (sym, pricedate, price) VALUES('msft', '1/3/9', 34)
INSERT INTO @pricetable (sym, pricedate, price) VALUES('msft', '1/4/9', 35)
INSERT INTO @pricetable (sym, pricedate, price) VALUES('ibm', '1/2/9', 66)
INSERT INTO @pricetable (sym, pricedate, price) VALUES('ibm', '1/3/9', 65)
INSERT INTO @pricetable (sym, pricedate, price) VALUES('ibm', '1/4/9', 64)
DECLARE @datestable TABLE (pricedate DATETIME)
INSERT INTO @datestable (pricedate) VALUES('1/1/9')
INSERT INTO @datestable (pricedate) VALUES('1/2/9')
INSERT INTO @datestable (pricedate) VALUES('1/3/9')
INSERT INTO @datestable (pricedate) VALUES('1/4/9')
SELECT AllDates.sym, AllDates.pricedate, outerp.price
FROM
(
SELECT
d.pricedate,
p.sym
FROM
@datestable AS d
CROSS JOIN @pricetable AS p
GROUP BY
d.pricedate,
p.sym
) AllDates
LEFT OUTER JOIN @pricetable AS outerp ON
outerp.pricedate = AllDates.pricedate
AND outerp.sym = AllDates.sym
ORDER BY AllDates.sym, AllDates.pricedate
Results:
sym pricedate price
---------- ----------------------- -----------
ibm 2009-01-01 00:00:00.000 NULL
ibm 2009-01-02 00:00:00.000 66
ibm 2009-01-03 00:00:00.000 65
ibm 2009-01-04 00:00:00.000 64
msft 2009-01-01 00:00:00.000 NULL
msft 2009-01-02 00:00:00.000 33
msft 2009-01-03 00:00:00.000 34
msft 2009-01-04 00:00:00.000 35