home
training courses
why choose us?
solutions
support
company
LearnItFirst User Forum
Welcome Guest
Search
|
New Posts
|
Members
|
Log In
|
Register
SQL Server Forum - LearnItFirst.com
»
Transact-SQL Programming
»
DML (SELECT, INSERT, UPDATE, DELETE) Questions
»
Date Query
Date Query
Options
Previous Topic
·
Next Topic
jvisconti
Posted:
Thursday, September 17, 2009 12:34:54 PM
Rank: Newbie
Joined: 9/17/2009
Posts: 1
Points: 3
Where do you live?: USA
I currently have the following SQL statement in a query that I am running as a View:
OPENDATETIME as TicketOpenDateTime,
(CAST(DATEPART(mm,OPENDATETIME) as VARCHAR)+'/'+
CAST(DATEPART(dd,OPENDATETIME) as VARCHAR)+'/'+
CAST(DATEPART(yyyy,OPENDATETIME)as VARCHAR)) AS TicketOpenDate,
(CAST(DATEPART(hh,OPENDATETIME) as VARCHAR)+':'+
CAST(DATEPART(mi,OPENDATETIME) as VARCHAR)) AS TicketOpenTime,
CLOSEDATETIME as TicketCloseDateTime,
(CASE CLOSEDATETIME
WHEN '1899-12-30' THEN NULL
ELSE
(CAST(DATEPART(mm,CLOSEDATETIME) as VARCHAR)+'/'+
CAST(DATEPART(dd,CLOSEDATETIME) as VARCHAR)+'/'+
CAST(DATEPART(yyyy,CLOSEDATETIME)as VARCHAR)) END) AS TicketCloseDate,
The query is then viewed in Excel 2007 and I am simply trying to pull the Date/Time data without needing the above code.
Back to top
Scott Whigham
Posted:
Tuesday, September 22, 2009 12:57:02 PM
Rank: Super Mod
Joined: 3/20/2006
Posts: 460
Points: 1,002
Where do you live?: Dallas, TX
So you want to connect Excel to SQL Server and just bring back these datetime columns, right? It can be done a few different ways. You can use Microsoft Query - part of Excel but it may not be installed - or you can connect to "Other Data Sources".
Back to top
Users browsing this topic
Guest
Forum Jump
SQL Server Database Administration
- General SQL Database Question & Answer
- Backup, Recovery and Disaster Recovery
- SQL Server Security
- Integration Services (SSIS) and DTS
Transact-SQL Programming
- DML (SELECT, INSERT, UPDATE, DELETE) Questions
- Stored Procedures, Triggers, & Functions
SQL Server Scripts, Code Samples and SSMS Custom Reports
- All SQL Server Versions
- SQL Server 2005/2008
- SQL Server Management Studio Custom Reports
Customer Service
- Video Requests
You
cannot
post new topics in this forum.
You
cannot
reply to topics in this forum.
You
cannot
delete your posts in this forum.
You
cannot
edit your posts in this forum.
You
cannot
create polls in this forum.
You
cannot
vote in polls in this forum.
SQL Server 2005 DBA Training Videos
SQL Server 2008 DBA Training Videos
Watch this topic
RSS Feed
Email this topic
Print this topic
Threaded
Normal