Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Assistance in converting INT into date. Expand / Collapse
Author
Message
Posted Monday, March 25, 2013 7:54 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, March 25, 2013 8:33 AM
Points: 8, Visits: 15
Perfect! Thank you so much. My SQL skills have just gotten better Cheers.
Post #1434928
Posted Monday, March 25, 2013 8:32 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 7:53 PM
Points: 22,511, Visits: 30,236
patrick.palmer (3/25/2013)
The filed has multiple dates in it. The 20050307 was just an example. Now all the dates say 2005-03-07???


The following was showing you a way to convert a date represented as an integer into a date:



-- SQL Server 2008 answer:

declare @MyDate int = 20050307;

select cast(cast(@MyDate as varchar(8)) as date);



It was up to you to figure out how to use it in your query.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1434942
Posted Monday, March 25, 2013 8:59 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Wednesday, March 26, 2014 10:01 AM
Points: 1,726, Visits: 486
Glad i could help.
Post #1434957
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse