Click here to Skip to main content
15,914,013 members
Home / Discussions / Database
   

Database

 
QuestionPIVOT in SQL 2005 problem Pin
Håkan Nilsson (k)8-Mar-07 0:20
Håkan Nilsson (k)8-Mar-07 0:20 
Questionoleobject in sql oracle mysql Pin
nikhil12347-Mar-07 22:35
nikhil12347-Mar-07 22:35 
AnswerRe: oleobject in sql oracle mysql Pin
Colin Angus Mackay8-Mar-07 0:08
Colin Angus Mackay8-Mar-07 0:08 
QuestionRegarding Video files Pin
praveen_gattu20007-Mar-07 21:22
praveen_gattu20007-Mar-07 21:22 
AnswerRe: Regarding Video files Pin
Paddy Boyd8-Mar-07 0:00
Paddy Boyd8-Mar-07 0:00 
AnswerRe: Insert Problem Pin
_anil_7-Mar-07 21:02
_anil_7-Mar-07 21:02 
GeneralRe: Insert Problem Pin
Colin Angus Mackay8-Mar-07 0:10
Colin Angus Mackay8-Mar-07 0:10 
Questionproblem on on date filtering Pin
firestoper7-Mar-07 19:45
firestoper7-Mar-07 19:45 
Hi G to U.R.U.S!

I want to return results based on entries on date range (Date From, Date To), the condition is that when the users doesn't fill up (leave blank) the date range (Date From and Date To), the SP should make use of oldest date and earliest date as date range.

Below is the SP I made which doesn't seem to work, please advice

<br />
(<br />
	@DateFrom datetime =null,<br />
	@DateTo datetime =null<br />
)<br />
as<br />
	begin	<br />
		<br />
		select <br />
			PageName,<br />
			count(PageName) as [Page Name]<br />
		from<br />
			PageViews<br />
		where <br />
			DateEntered > <br />
				case when @DateFrom is null then (select convert(char(12),min(DateEntered)) from pageviews)<br />
					<br />
				else<br />
					dateadd(day,-1,@DateFrom) <br />
				end				<br />
		and <br />
				DateEntered <<br />
				case when @DateTo is null then (select convert(char(12),max(DateEntered)) from pageviews)<br />
				else<br />
					dateadd(day,1,@DateTo)<br />
				end<br />
		group by<br />
			PageName<br />
		order by <br />
			[Page Name]<br />
<br />
	end<br />
<br />


Thanks
Dom
AnswerRe: problem on on date filtering Pin
andyharman7-Mar-07 22:40
professionalandyharman7-Mar-07 22:40 
GeneralRe: problem on on date filtering Pin
firestoper7-Mar-07 22:53
firestoper7-Mar-07 22:53 
GeneralRe: problem on on date filtering Pin
Pete O'Hanlon8-Mar-07 0:45
mvePete O'Hanlon8-Mar-07 0:45 
GeneralRe: problem on on date filtering Pin
andyharman8-Mar-07 1:38
professionalandyharman8-Mar-07 1:38 
AnswerRe: problem on on date filtering Pin
Harini N K7-Mar-07 23:59
Harini N K7-Mar-07 23:59 
QuestionAuto database connection when SQL Server 2005 restarts Pin
zxc897-Mar-07 18:43
zxc897-Mar-07 18:43 
Questioncommunicating SQL server with DB2 Pin
ajit zamindar7-Mar-07 18:34
ajit zamindar7-Mar-07 18:34 
QuestionDatabase contention Pin
Darkness847-Mar-07 11:56
Darkness847-Mar-07 11:56 
AnswerRe: Database contention Pin
Dave Kreskowiak7-Mar-07 12:30
mveDave Kreskowiak7-Mar-07 12:30 
GeneralRe: Database contention Pin
Darkness847-Mar-07 12:38
Darkness847-Mar-07 12:38 
GeneralRe: Database contention Pin
Dave Kreskowiak7-Mar-07 12:46
mveDave Kreskowiak7-Mar-07 12:46 
QuestionHeterogeneous queries Pin
alexrad7-Mar-07 11:03
alexrad7-Mar-07 11:03 
AnswerRe: Heterogeneous queries Pin
alexrad7-Mar-07 11:18
alexrad7-Mar-07 11:18 
QuestionReturning a DataSet from a Stored Procedure within a S.P. Pin
dwatkins@dirq.net7-Mar-07 9:44
dwatkins@dirq.net7-Mar-07 9:44 
AnswerRe: Returning a Resultset from a Stored Procedure within a S.P. Pin
andyharman7-Mar-07 22:36
professionalandyharman7-Mar-07 22:36 
Questionhow split function work in sql [modified] Pin
findtango7-Mar-07 5:06
findtango7-Mar-07 5:06 
AnswerRe: how split function work in sql Pin
Mark J. Miller7-Mar-07 5:29
Mark J. Miller7-Mar-07 5:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.