[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Create a SQL Table from attached excel template

Posted on 2013-12-17
5
Medium Priority
?
386 Views
Last Modified: 2016-02-10
I would like to create a simple SQL 2012 table structure with default settings based on a static excel template, the only field that will ever change is the 'Current Date' :- see below snapshot and attached excel sheet.

12-17-2013-4-40-54-PM.gifHourTrack3.xls
0
Comment
Question by:John-S Pretorius
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 39725404
The SSIS wizard answer is...
Go into SQL Server SSMS
Identify the database where you wish to import the Excel spreadsheet data, and click.
Right-click > Tasks > Import Data..., and follow the prompts
0
 

Author Comment

by:John-S Pretorius
ID: 39725419
Thank you, this part seems pretty straight forward - I have one field in excel that's the actual true currentdate - is there a way that I can script the SQL to change accordingly ?
0
 

Author Comment

by:John-S Pretorius
ID: 39725435
Also is there any way the highlighted changed can now be made to SQL : See below

SQL
0
 
LVL 49

Accepted Solution

by:
PortletPaul earned 1500 total points
ID: 39725905
You do not need to store the "current date" in the table at all.

Why not simply create a view, like this

create MyView as
select
Intervals, TimeToSec, Fraction, Time, Time_Hours, convert(date,getdate()) as CurrentDate
from MyTable

then you would use "MyView" instead of "MyTable" in subsequent SQL code, e.g.

select d.*, MyView.CurrentDate
from SomeDataTable as d
inner join MyView on d.intervals = MyView.intervals


NB: above I suggested:
 convert(date, getdate() ) as CurrentDate

If you need a datetime column instead of date then do this:

 convert(datetime, convert(date, getdate() ) ) as CurrentDate
0
 

Author Closing Comment

by:John-S Pretorius
ID: 39726686
Thank you - your assistance got me what I needed.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question