SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Input Parameter


Input Parameter

Author
Message
sharonsql2013
sharonsql2013
Mr or Mrs. 500
Mr or Mrs. 500 (584 reputation)Mr or Mrs. 500 (584 reputation)Mr or Mrs. 500 (584 reputation)Mr or Mrs. 500 (584 reputation)Mr or Mrs. 500 (584 reputation)Mr or Mrs. 500 (584 reputation)Mr or Mrs. 500 (584 reputation)Mr or Mrs. 500 (584 reputation)

Group: General Forum Members
Points: 584 Visits: 1265
I need the Input Parameter to display monthyear in drop down fashion.

example : Aug2013 or Feb2011

How can I achieve this?
Also , The source table does not have all the years , will we have to use a separate data set for this ?
lynns
lynns
SSC-Enthusiastic
SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)

Group: General Forum Members
Points: 141 Visits: 323
I would use a separate dataset to generate the data. The following query creates 36 months of entries beginning at 1/1/2011.

SELECT (CHOOSE(DATEPART(m,dateadd(month,number,'20110101')),'JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'))
+ (CONVERT(nvarchar(4),DATEPART(yyyy,DATEADD(month,number, '20110101'))))
from master..spt_values
where type = 'p' AND number < 36
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search