Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

For Creating Date Columns Dynamically

$
0
0

hi,

Can Some one help me for creating a date columns dynamically.

--> 1) I have a column called Received_Dates Having datatype of datetime .

--> 2) I need to make the data in Received_Dates  into columns.

Example :

Received_Date

1/1/2014   ----  Jan 1 

1/2/2013  ---- Jan 2

1/3/2013 ----  Jan 3

1/4/2013 ----  Jan 4

1/5/2013 ----  Jan 5

1/6/2013 ----  Jan 6

.

.

.

.

.

.

12/25/2013----  Dec 25

12/26/2013----  Dec 26

12/27/2013----  Dec 27

12/28/2013----  Dec 28

12/29/2013----  Dec 29

12/30/2013----  Dec 30

12/31/2013----  Dec 31

All i want to do is i a have take a received_datecolumn  values  to Columns  with respest to Month and its date

OUTPUT Like :

 Name      1/1/2013   1/2/2013     1/3/2013    1/4/2013  ...............  1/31/2013    

  Satish             1                 5                         6                     8        ................     34                                                

  Malli                 56              75                       16                    0        ................    4                        

Like the above i should get If the month is Feb I need to get 28 Columns .

Here with respect to names i need to show how many records the employee completed.

NOTE : In Actual table i have in names in Rows and Dates In Rows, All i need is to make the dates as column with respect to particular month  and show a values as shown above.

Is there any thing to make t dynamically because  We will be having leap year and also datesvaries with respect to month.

Please, Do me need full Very Emergency.

Thanks In advance. 



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>