Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

I am having table with two columns like this

eid    date
-----------
01     04/12/09
02     03/04/09


Now I need output like this

eid    1    2   3   4  5   6  7   8 ----------  31

01     a    a   a   p  a   a  a   a             a 

02     p    p   p   p


I need to use stored procedures and have to give parameter of empid there in stored procedure

Then if I give empid I have to get present or absent of that day in a month.
Posted
Updated 8-Dec-09 11:50am
v2

1 solution

If you are using SQL Server 2005 or above, you can use the PIVOT TSQL to achieve the crosstab result.

In case of SQL 2000 or earlier, you would have to create a dynamic sql and execute it to get the result.

[External Link on solution]
 
Share this answer
 

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