Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I need a query to display the date like below. Thank you in advance.9/1/0710/1/0711/1/0712/1/071/1/08…12/1/091/1/10
tkizer
Almighty SQL Goddess
38200 Posts
Posted - 2010-01-19 : 23:09:45
Use CONVERT with the appropriate style if you are using datetime data type. But you really should do this type of formatting inside your application and not in T-SQL. Keep presentation issues to the presentation layer.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog"Let's begin with the premise that everything you've done up until this point is wrong."
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2010-01-19 : 23:46:29
or do you want to generate a lists of date for 1st of the month ?
select [Date] = dateadd(month, number, '2007-09-01')from master..spt_valueswhere type = 'P'and number <= datediff(month, '2007-09-01', '2010-01-01')
KH[spoiler]Time is always against us[/spoiler]
X002548
Not Just a Number
15586 Posts
Posted - 2010-01-19 : 23:50:19
OR Do you want to be be more clear in you post...i.e.What's the data type of the column?Can you post the DDL of the table?Can you post dsample Data in the form of DML?Can you tell us if you love Al Q....no, that's too farBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam