Click here to Skip to main content
15,914,642 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i am working on attendance system project..
I have attendance table will all the employee according to their working day status,
i have the query `select EmpId,AttenDate,status from dbo.Attendance`

it will give me this



1500011 2014-09-01 00:00:00.000
A

1500011 2014-09-02 00:00:00.000
A

1500011 2014-09-03 00:00:00.000
A

1500011 2014-09-04 00:00:00.000
A

1500011 2014-09-05 00:00:00.000
A

1500011 2014-09-06 00:00:00.000
P

1500011 2014-09-07 00:00:00.000
A

.

.

.

upto 2014-09-31 00:00:00.000
A



68 2014-08-01 00:00:00.000
A

68 2014-08-02 00:00:00.000
P

68 2014-08-03 00:00:00.000
A



68 2014-09-07 00:00:00.000 A

.

.

.

upto 2014-09-31 00:00:00.000
A









Now i want to print it into the excel sheet

with is format



Empid 1
2 3
4 5
6 7
8 upto 31

1500011 A A A
A A
P A
A upto A

68 A
A P
....................upto A







Please suggest me??
Posted
Updated 13-Nov-14 18:04pm
v2

1 solution

Try this..

SQL
select EmpId+' '+convert(varchar(50),AttenDate,120)+CHAR(13)+status from dbo.Attendance


SQL
here CHAR(13)
for the New line and 

convert(varchar(50),AttenDate,120)
120 for the Date Format to Convert AttenDate into YYYY-MM-dd format


think this'll help you.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900