Click here to Skip to main content
15,908,843 members
Home / Discussions / Database
   

Database

 
QuestionSql Doubt Pin
rajanandal15-Dec-09 2:26
rajanandal15-Dec-09 2:26 
AnswerRe: Sql Doubt Pin
Richard MacCutchan15-Dec-09 2:39
mveRichard MacCutchan15-Dec-09 2:39 
GeneralRe: Sql Doubt Pin
rajanandal15-Dec-09 2:53
rajanandal15-Dec-09 2:53 
GeneralRe: Sql Doubt Pin
dxlee15-Dec-09 4:27
dxlee15-Dec-09 4:27 
AnswerRe: Sql Doubt Pin
Niladri_Biswas15-Dec-09 15:18
Niladri_Biswas15-Dec-09 15:18 
GeneralRe: Sql Doubt Pin
rajanandal15-Dec-09 23:28
rajanandal15-Dec-09 23:28 
QuestionSQL Between Stored Proc Pin
Illegal Operation14-Dec-09 18:08
Illegal Operation14-Dec-09 18:08 
AnswerRe: SQL Between Stored Proc Pin
Niladri_Biswas14-Dec-09 18:15
Niladri_Biswas14-Dec-09 18:15 
select * from table
where datecolumn between date1 and date2

e.g.

declare @t table(activity varchar(10),datecol datetime)
insert into @t 
	select 'activity1', '2009-12-01' union all
	select 'activity2','2009-12-02' union all
	select 'activity3','2009-12-15' union all
	select 'activity4','2010-01-02' union all
	select 'activity5','2009-12-31'


Declare 2 date variables

declare @date1 datetime,@date2 datetime
set @date1 = '2009-12-01'
set @date2 = '2009-12-15'


I want to select records between 1st Dec 2009 to 15th Dec 2009.

Query:

select * from @t
where datecol between @date1 and @date2


Output:

activity datecol
activity1	2009-12-01 00:00:00.000
activity2	2009-12-02 00:00:00.000
activity3	2009-12-15 00:00:00.000


Niladri Biswas

AnswerRe: SQL Between Stored Proc Pin
Andy_L_J14-Dec-09 18:36
Andy_L_J14-Dec-09 18:36 
Questionssis script component Pin
Ebube14-Dec-09 4:24
Ebube14-Dec-09 4:24 
QuestionRe: ssis script component Pin
Unforgiv3n17-Dec-09 20:50
Unforgiv3n17-Dec-09 20:50 
QuestionCan VS support Ruby on Rails -like database migrations? Pin
GarethHowell14-Dec-09 2:40
GarethHowell14-Dec-09 2:40 
AnswerRe: Can VS support Ruby on Rails -like database migrations? Pin
i.j.russell14-Dec-09 9:07
i.j.russell14-Dec-09 9:07 
Questionwhere clause in sql [modified] Pin
AndyInUK14-Dec-09 0:22
AndyInUK14-Dec-09 0:22 
AnswerRe: where clause in sql Pin
David Skelly14-Dec-09 0:34
David Skelly14-Dec-09 0:34 
GeneralRe: where clause in sql Pin
AndyInUK14-Dec-09 0:39
AndyInUK14-Dec-09 0:39 
AnswerRe: where clause in sql Pin
Luc Pattyn14-Dec-09 1:29
sitebuilderLuc Pattyn14-Dec-09 1:29 
GeneralRe: where clause in sql Pin
AndyInUK14-Dec-09 1:31
AndyInUK14-Dec-09 1:31 
GeneralRe: where clause in sql Pin
Eddy Vluggen14-Dec-09 1:40
professionalEddy Vluggen14-Dec-09 1:40 
GeneralRe: where clause in sql Pin
Luc Pattyn14-Dec-09 1:59
sitebuilderLuc Pattyn14-Dec-09 1:59 
GeneralRe: where clause in sql Pin
Niladri_Biswas14-Dec-09 18:12
Niladri_Biswas14-Dec-09 18:12 
QuestionDSn Creation through SQLConfigDataSource() funciton Pin
Durga_Devi14-Dec-09 0:19
Durga_Devi14-Dec-09 0:19 
QuestionHow to identify the ID of row which has been modified? Pin
Member 470414312-Dec-09 13:26
Member 470414312-Dec-09 13:26 
AnswerRe: How to identify the ID of row which has been modified? Pin
dan!sh 12-Dec-09 18:49
professional dan!sh 12-Dec-09 18:49 
AnswerRe: How to identify the ID of row which has been modified? Pin
Mycroft Holmes13-Dec-09 13:44
professionalMycroft Holmes13-Dec-09 13:44 

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.