probe con esto y funciona:
Código SQL:
Ver originalCREATE TABLE #temp
(
fecha1 datetime,
fecha2 datetime
)
INSERT INTO #temp VALUES ('2013-08-30 00:00:00.000', NULL)
INSERT INTO #temp VALUES ('2013-08-30 00:00:00.000', '2013-09-11 09:22:11.967')
INSERT INTO #temp VALUES ('2013-08-30 00:00:00.000', NULL)
INSERT INTO #temp VALUES ('2013-08-30 00:00:00.000', NULL)
INSERT INTO #temp VALUES ('2013-08-30 00:00:00.000', NULL)
INSERT INTO #temp VALUES ('2013-09-03 12:08:27.003', '2013-09-03 12:13:58.537')
INSERT INTO #temp VALUES (NULL,NULL)
INSERT INTO #temp VALUES ('2013-09-03 12:08:27.003', NULL)
INSERT INTO #temp VALUES ('2013-09-03 12:08:27.003', NULL)
INSERT INTO #temp VALUES ('2013-09-03 12:08:27.003', NULL)
INSERT INTO #temp VALUES ('2013-09-22 16:54:00.320', NULL)
INSERT INTO #temp VALUES ('2013-10-14 16:20:21.823', NULL)
DECLARE @fh_inicio datetime
DECLARE @fh_fin datetime
SET @fh_inicio='2013-01-01'
SET @fh_fin='2013-09-12'
SELECT * FROM #temp WHERE
CASE WHEN fecha2 IS NOT NULL THEN fecha2 ELSE fecha1 END
BETWEEN ISNULL(@fh_Inicio, CASE WHEN fecha2 IS NOT NULL THEN fecha2 ELSE fecha1 END) AND
ISNULL(@fh_Fin, CASE WHEN fecha2 IS NOT NULL THEN fecha2 ELSE fecha1 END)
saludos!