Solved

Create a SQL Table from attached excel template

Posted on 2013-12-17
5
371 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
  • 3
5 Comments
 
LVL 65

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 48

Accepted Solution

by:
PortletPaul earned 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Lessons learned during ten years of interviewing for SQL Server Integration Services (SSIS) and other Extract-Transform-Load (ETL) contract roles and two years of staff manager interviewing contractors.
My client sends a request to me that they want me to load data, which will be returned by Web Service APIs, and do some transformation before importing to database. In this article, I will provide an approach to load data with Web Service Task and X…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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