title: SQL pulling into Excel as text
body: <p>The data I'm pulling in from a SQL server is being <em>displayed</em> correctly as a date or number, but the data seems to be <em>stored</em> as text. For example, if I pulled in data with the number value 1, the cell would display "1" (no quotes) in it but Excel would not recognize it as a number - I can't perform any math to it and it won't be recognized as a number. I can fix that by selecting the cell and doing F2+Enter.</p>
  
  <p>To clarify, the SQL data is not formatted in Excel as text. Changing formats does not solve my issue. The actual data in the cells isn't being recognized by Excel as numbers or dates, no matter what format I make the cells. I have to manually select and F2+Enter.</p>
  
  <pre><code>select distinct vl.Property As 'Property'
  , vl.Property As 'Property number'
  , vl.LeaseID as 'Lease ID'
  , vl.priorleaseid as 'Prior lease ID'
  
  from realpage_uds.dbo.property p
  
  inner join realpage_uds.dbo.vwsa_lease vl
  on p.propertyid = vl.propertyid
  
  
  where p.name like '%Name%'
  </code></pre>
  
  <p>vl.LeaseID is a good example. It is data type "T-IDNumeric", system type "numeric" yet I can't select a leaseID and perform any arithmetic to it in Excel.</p>
  
  <p>I'm pulling in the SQL data to Excel in the following way:</p>
  
  <ol>
  <li>Go to "Data" tab, click "From Other Sources" under "Get External
  Data"</li>
  <li>Choose "From SQL server", enter server name to connect</li>
  <li>Connect to a database and choose a random table in the database</li>
  <li>Click finish, and choose to pull in the data as a table or pivot table. I've used both and they both have this issue.</li>
  <li>Finally, update the SQL query under connection properties, and change the query to my desired query that I have typed up. Then I choose "SQL" and hit OK.</li>
  </ol>
  
  <p>Has anyone else experienced this? Is there a way I can make the SQL data pull in as a number and date, and not have to manually select the cell and F2+Enter to get Excel to recognize the data?</p>
  
  <p>Alternatively, if there is no way to change the way the SQL data pulls in, is there a macro I could implement to change all text data in a spreadsheet to number or date values?</p>
  
  <p>Any help is greatly appreciated!</p>