Solved

Create a SQL Table from attached excel template

Posted on 2013-12-17
5
362 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

In couple weeks ago, I encountered an extremely difficult problem while deploying 2008 SSIS packages to a new environment (SQL Server 2014 standard).  My scenario is: We have one C# application that is calling 2008R2 SSIS packages to load text fi…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now