SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


.csv file data load into SQL Server (same date file multiple times and figure out inside no of...


.csv file data load into SQL Server (same date file multiple times and figure out inside no of column and based on insert particular table.)

Author
Message
zoom19
zoom19
Valued Member
Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)

Group: General Forum Members
Points: 50 Visits: 302



/****** Object: Table [dbo].[Paychex_t_ClockID] Script Date: 04/23/2013 14:59:07 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Paychex_t_ClockID]') AND type in (N'U'))
DROP TABLE [dbo].[Paychex_t_ClockID]
GO



/****** Object: Table [dbo].[Paychex_t_ClockID] Script Date: 04/23/2013 14:59:07 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Paychex_t_ClockID](
[Employee] [varchar](50) NULL,
[First Name] [varchar](100) NULL,
[Last Name] [varchar](100) NULL,
[Date] Datetime null,
[ClockID] int NULL,

) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

---------------------------------


/****** Object: Table [dbo].[Paychex_t_ClockData] Script Date: 04/23/2013 14:59:07 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Paychex_t_ClockData]') AND type in (N'U'))
DROP TABLE [dbo].[Paychex_t_ClockData]
GO



/****** Object: Table [dbo].[Paychex_t_ClockData] Script Date: 04/23/2013 14:59:07 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Paychex_t_ClockData](
[Employee] [varchar](50) NULL,
[Title] [varchar](1000) NULL,
[First Name] [varchar](100) NULL,
[Last Name] [varchar](100) NULL,
[Start Date] Datetime NULL,
[Start Time ] time NULL,
[End Time] time NULL,
[Total Hours ] float NULL,
[OT1] [varchar](50) NULL,
[Pay Type Code ] [varchar](50) NULL,
[Pay Type Description] [varchar](50) NULL,
[Salary Type] [varchar](50) NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

---------------------------------------



IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF__FileContr__Proce__2355CBBA]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[FileControl] DROP CONSTRAINT [DF__FileContr__Proce__2355CBBA]
END

GO


/****** Object: Table [dbo].[FileControl] Script Date: 04/24/2013 14:56:14 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FileControl]') AND type in (N'U'))
DROP TABLE [dbo].[FileControl]
GO


/****** Object: Table [dbo].[FileControl] Script Date: 04/24/2013 14:56:14 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[FileControl](
[ImportedFileName] [varchar](1000) NOT NULL,
[RecordsImported] [int] NOT NULL,
[ProcessDate] [datetime] NOT NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[FileControl] ADD DEFAULT (getdate()) FOR [ProcessDate]
GO




Above I created 3 tables for loading data from .csv file.
In post, I convert my .csv file into .xls format because not permitted .csv file attachment.
also added my package also.

---> Now getting error when importing data from same location and even how to verify which file going from which table.
--> one more question also if same date file comes twice time then before inserting want to delete those records which have same startdate.

And I am new with SSIS.......

In Advance appreciate your help.
Please advice me.
Attachments
Paychex.png (11 views, 18.00 KB)
Paychex1.png (8 views, 26.00 KB)
Custom-4232013114030.xls (13 views, 27.00 KB)
Custom-4232013114227.xls (12 views, 28.00 KB)
Custom-4232013114312.xls (3 views, 196.00 KB)
Custom-4232013123150.xls (5 views, 98.00 KB)
Paychex.rar (5 views, 56.00 KB)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search