Click here to Skip to main content
15,909,829 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to Call A web service inside SQL server Pin
David Skelly7-Dec-11 22:26
David Skelly7-Dec-11 22:26 
GeneralRe: How to Call A web service inside SQL server Pin
yousefshokati8-Dec-11 0:28
yousefshokati8-Dec-11 0:28 
AnswerRe: How to Call A web service inside SQL server Pin
SilimSayo8-Dec-11 8:27
SilimSayo8-Dec-11 8:27 
QuestionExporting and Importing data from and into SQL Server 2008 Pin
SQL Ed7-Dec-11 2:58
SQL Ed7-Dec-11 2:58 
AnswerRe: Exporting and Importing data from and into SQL Server 2008 Pin
Blue_Boy7-Dec-11 3:11
Blue_Boy7-Dec-11 3:11 
QuestionSum the counts from two different tables Pin
Elizabeth Rani7-Dec-11 1:04
Elizabeth Rani7-Dec-11 1:04 
AnswerRe: Sum the counts from two different tables Pin
Corporal Agarn7-Dec-11 8:46
professionalCorporal Agarn7-Dec-11 8:46 
AnswerRe: Sum the counts from two different tables Pin
SilimSayo7-Dec-11 12:50
SilimSayo7-Dec-11 12:50 
Try this.
SQL
DECLARE
@holidayCount AS int,
@startDate AS datetime,
@endData AS datetime,
@empCode AS VARCHAR(20)

SET @startDate='11/24/2011 00:00:00.000'
SET @endDate='11/27/2011 23:59:59.997' 
SET @empCode='EMP001'

SET @holidayCount=(SELECT COUNT(*) FROM tbl_holidays WHERE
                   holidays BETWEEN @startDate AND @endDate)

--I am assuming that 'holidays' is a datetime field/column

SELECT empCode, name, (Counts + @holidayCount) As holidayCounts 
FROM
(
   SELECT a.empCode, b.name, (Count(*) as Counts 
   FROM tbl_leaveentry a,tbl_emp b
   WHERE   a.empCode=b.empCode AND
           a.empCode=@empCode AND
           a.entryDate @startDate and @endDate
GROUP BY by a.empCode,b.name
) AS temp
WHERE  Counts + @holidayCount>3

GeneralRe: Sum the counts from two different tables Pin
Elizabeth Rani7-Dec-11 19:46
Elizabeth Rani7-Dec-11 19:46 
GeneralRe: Sum the counts from two different tables Pin
SilimSayo8-Dec-11 3:25
SilimSayo8-Dec-11 3:25 
Questioncreate user account Pin
Danzy835-Dec-11 15:40
Danzy835-Dec-11 15:40 
AnswerRe: create user account Pin
Mycroft Holmes5-Dec-11 16:52
professionalMycroft Holmes5-Dec-11 16:52 
GeneralRe: create user account Pin
Danzy835-Dec-11 21:57
Danzy835-Dec-11 21:57 
QuestionIntegration Services or C# code Pin
RichardInToronto5-Dec-11 15:00
RichardInToronto5-Dec-11 15:00 
AnswerRe: Integration Services or C# code Pin
Mycroft Holmes5-Dec-11 16:49
professionalMycroft Holmes5-Dec-11 16:49 
GeneralRe: Integration Services or C# code Pin
Jörgen Andersson5-Dec-11 20:30
professionalJörgen Andersson5-Dec-11 20:30 
GeneralRe: Integration Services or C# code Pin
RichardInToronto7-Dec-11 15:35
RichardInToronto7-Dec-11 15:35 
AnswerRe: C# code Pin
David Mujica6-Dec-11 5:55
David Mujica6-Dec-11 5:55 
GeneralRe: C# code Pin
RichardInToronto7-Dec-11 4:09
RichardInToronto7-Dec-11 4:09 
GeneralRe: C# code Pin
David Mujica7-Dec-11 8:08
David Mujica7-Dec-11 8:08 
GeneralRe: C# code Pin
RichardInToronto7-Dec-11 15:31
RichardInToronto7-Dec-11 15:31 
GeneralRe: C# code Pin
Mycroft Holmes7-Dec-11 15:55
professionalMycroft Holmes7-Dec-11 15:55 
Questiondatabase role permissions Pin
Danzy835-Dec-11 3:53
Danzy835-Dec-11 3:53 
AnswerRe: database role permissions Pin
R. Giskard Reventlov5-Dec-11 4:11
R. Giskard Reventlov5-Dec-11 4:11 
QuestionHow to import data from excel to sql server 2005 Pin
rahul honey4-Dec-11 23:47
rahul honey4-Dec-11 23:47 

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.