Showing posts with label archive. Show all posts
Showing posts with label archive. Show all posts

Monday, March 26, 2012

how to Archive the Flat files after they are loaded into a directory

I have to archive the Flat files after they are loaded into an archive folder with a Date time stamp on the folder in the format mmddyyyyhhmmss what task should i use in ssis to complete this and can i do this task for multiple files in the directory, how should i configure such that all files are archived and placed in one directory with a current timestamp, Please Provide me with a solution

Dev2624 wrote:

I have to archive the Flat files after they are loaded into an archive folder with a Date time stamp on the folder in the format mmddyyyyhhmmss what task should i use in ssis to complete this and can i do this task for multiple files in the directory, how should i configure such that all files are archived and placed in one directory with a current timestamp, Please Provide me with a solution

Use the FileSystem Task. You should also look into the MULTIFILE connection manager. See if these do what you want and if you have any problems, reply here.

-Jamie

|||

I am sorry if i had confused with my topic but what i want to do is once i load the Flat file into the dimension i want to archive that file in another directory with the current date time stamp. Please provide me the solution using ssis.

ex: source file abc.txt

i want to archive as abcmm/dd/yyyy.txt in archive folder say folderarchive

|||

I think Jamie pointed you in the right direction. See if this example takes you further:

http://rafael-salas.blogspot.com/2007/03/ssis-file-system-task-move-and-rename.html

|||

Dev2624 wrote:

I am sorry if i had confused with my topic but what i want to do is once i load the Flat file into the dimension i want to archive that file in another directory with the current date time stamp. Please provide me the solution using ssis.

ex: source file abc.txt

i want to archive as abcmm/dd/yyyy.txt in archive folder say folderarchive

I perfectly understand what you want to do and I am trying to help you. What I am NOT going to do is write the solution for you.

Have you identified that the FileSystem task can be used to move files? Hopefully you have. if you want to change the name of the file when you move it then use expressions.

This should particularly help:

Setting expressions

(http://blogs.conchango.com/jamiethomson/archive/2006/03/11/SSIS-Nugget_3A00_-Setting-expressions.aspx)

As might this:

Searching for "FileSystem" on the SSIS search macro

(http://search.live.com/results.aspx?FORM=QBJK&q1=macro%3Ajamiet.ssis&q=filesystem or http://search.live.com/results.aspx?q=file+system&form=QBRE&q1=macro%3Ajamiet.ssis)

Rafael also has a very good post on it:

File System Task Move and rename files in one step

(http://rafael-salas.blogspot.com/2007/03/ssis-file-system-task-move-and-rename.html)

-Jamie

|||

Jamie Thomson wrote:

Rafael also has a very good post on it:

File System Task Move and rename files in one step

(http://rafael-salas.blogspot.com/2007/03/ssis-file-system-task-move-and-rename.html)

As you now know seeing as he beat me to a reply Smile

|||

Thanks for the quick responses , both the links provided me an insight i will be working on it and let both know about any further issues. Thanks for the response

|||

I was able to do that thanks for the help but i have one more thing ahead is that i have to rename the file using a value taken from the header row in the file. Do i need to use a global variable and capture header into that.

I am a newbie and your direction is encouraging i also need your guidance in checking whether a list of files exist in the directory or not how can i acheive that , i used scripting task to check for whether a single file exists but how to check for multiple files , is there a way we can configure the scripting task to check for list of files.

Please guide me

|||

If you need a data element that inside of the file; you can use an script task to get it.

There are several ways to check if a file already exists. If you already have an script task that check for 1 file; you could embed it in a ForEachLoop with a File enumerator to loop through all files in a directory.

how to Archive the Flat files after they are loaded into a directory

I have to archive the Flat files after they are loaded into an archive folder with a Date time stamp on the folder in the format mmddyyyyhhmmss what task should i use in ssis to complete this and can i do this task for multiple files in the directory, how should i configure such that all files are archived and placed in one directory with a current timestamp, Please Provide me with a solution

Dev2624 wrote:

I have to archive the Flat files after they are loaded into an archive folder with a Date time stamp on the folder in the format mmddyyyyhhmmss what task should i use in ssis to complete this and can i do this task for multiple files in the directory, how should i configure such that all files are archived and placed in one directory with a current timestamp, Please Provide me with a solution

Use the FileSystem Task. You should also look into the MULTIFILE connection manager. See if these do what you want and if you have any problems, reply here.

-Jamie

|||

I am sorry if i had confused with my topic but what i want to do is once i load the Flat file into the dimension i want to archive that file in another directory with the current date time stamp. Please provide me the solution using ssis.

ex: source file abc.txt

i want to archive as abcmm/dd/yyyy.txt in archive folder say folderarchive

|||

I think Jamie pointed you in the right direction. See if this example takes you further:

http://rafael-salas.blogspot.com/2007/03/ssis-file-system-task-move-and-rename.html

|||

Dev2624 wrote:

I am sorry if i had confused with my topic but what i want to do is once i load the Flat file into the dimension i want to archive that file in another directory with the current date time stamp. Please provide me the solution using ssis.

ex: source file abc.txt

i want to archive as abcmm/dd/yyyy.txt in archive folder say folderarchive

I perfectly understand what you want to do and I am trying to help you. What I am NOT going to do is write the solution for you.

Have you identified that the FileSystem task can be used to move files? Hopefully you have. if you want to change the name of the file when you move it then use expressions.

This should particularly help:

Setting expressions

(http://blogs.conchango.com/jamiethomson/archive/2006/03/11/SSIS-Nugget_3A00_-Setting-expressions.aspx)

As might this:

Searching for "FileSystem" on the SSIS search macro

(http://search.live.com/results.aspx?FORM=QBJK&q1=macro%3Ajamiet.ssis&q=filesystem or http://search.live.com/results.aspx?q=file+system&form=QBRE&q1=macro%3Ajamiet.ssis)

Rafael also has a very good post on it:

File System Task Move and rename files in one step

(http://rafael-salas.blogspot.com/2007/03/ssis-file-system-task-move-and-rename.html)

-Jamie

|||

Jamie Thomson wrote:

Rafael also has a very good post on it:

File System Task Move and rename files in one step

(http://rafael-salas.blogspot.com/2007/03/ssis-file-system-task-move-and-rename.html)

As you now know seeing as he beat me to a reply Smile

|||

Thanks for the quick responses , both the links provided me an insight i will be working on it and let both know about any further issues. Thanks for the response

|||

I was able to do that thanks for the help but i have one more thing ahead is that i have to rename the file using a value taken from the header row in the file. Do i need to use a global variable and capture header into that.

I am a newbie and your direction is encouraging i also need your guidance in checking whether a list of files exist in the directory or not how can i acheive that , i used scripting task to check for whether a single file exists but how to check for multiple files , is there a way we can configure the scripting task to check for list of files.

Please guide me

|||

If you need a data element that inside of the file; you can use an script task to get it.

There are several ways to check if a file already exists. If you already have an script task that check for 1 file; you could embed it in a ForEachLoop with a File enumerator to loop through all files in a directory.

sql

How to Archive current sql server logs

Hi Guru's,
It takes me a long time to view in EM under Mangement/SQL Server Logs/current file. Is there a way I can shorten that file so it won't take so long to view the current file?
Thanks in advance. :eek:DBCC ERRORLOG will rotate the logs. I set up a job to rotate mine once per month.|||DBCC ERRORLOG will rotate the logs. I set up a job to rotate mine once per month.

sp_cycle_errorlog will achieve the same effect. You might also consider taking a look at sp_delete_ backuphistory.

Regards,

hmscott

How to archive current sql server logs

Hi Guru's,
It takes me a long time to view in EM under Mangement/SQL Server
Logs/current file. Is there a way I can shorten that file so it won't take so
long to view the current file?
Thanks in advance.
New SQL Server DBA
Hi
EXEC sp_cycle_errorlog
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:29D176A0-3569-437D-8F87-7E68DF978AF7@.microsoft.com...
> Hi Guru's,
> It takes me a long time to view in EM under Mangement/SQL Server
> Logs/current file. Is there a way I can shorten that file so it won't take
> so
> long to view the current file?
> Thanks in advance.
> --
> New SQL Server DBA
|||THANKS!
New SQL Server DBA
"Mike Epprecht (SQL MVP)" wrote:

> Hi
> EXEC sp_cycle_errorlog
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Newbie" <Newbie@.discussions.microsoft.com> wrote in message
> news:29D176A0-3569-437D-8F87-7E68DF978AF7@.microsoft.com...
>
>

How to archive current sql server logs

Hi Guru's,
It takes me a long time to view in EM under Mangement/SQL Server
Logs/current file. Is there a way I can shorten that file so it won't take so
long to view the current file?
Thanks in advance.
--
New SQL Server DBAHi
EXEC sp_cycle_errorlog
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:29D176A0-3569-437D-8F87-7E68DF978AF7@.microsoft.com...
> Hi Guru's,
> It takes me a long time to view in EM under Mangement/SQL Server
> Logs/current file. Is there a way I can shorten that file so it won't take
> so
> long to view the current file?
> Thanks in advance.
> --
> New SQL Server DBA|||THANKS!
--
New SQL Server DBA
"Mike Epprecht (SQL MVP)" wrote:
> Hi
> EXEC sp_cycle_errorlog
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Newbie" <Newbie@.discussions.microsoft.com> wrote in message
> news:29D176A0-3569-437D-8F87-7E68DF978AF7@.microsoft.com...
> > Hi Guru's,
> >
> > It takes me a long time to view in EM under Mangement/SQL Server
> > Logs/current file. Is there a way I can shorten that file so it won't take
> > so
> > long to view the current file?
> >
> > Thanks in advance.
> > --
> > New SQL Server DBA
>
>

How to archive current sql server logs

Hi Guru's,
It takes me a long time to view in EM under Mangement/SQL Server
Logs/current file. Is there a way I can shorten that file so it won't take s
o
long to view the current file?
Thanks in advance.
--
New SQL Server DBAHi
EXEC sp_cycle_errorlog
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:29D176A0-3569-437D-8F87-7E68DF978AF7@.microsoft.com...
> Hi Guru's,
> It takes me a long time to view in EM under Mangement/SQL Server
> Logs/current file. Is there a way I can shorten that file so it won't take
> so
> long to view the current file?
> Thanks in advance.
> --
> New SQL Server DBA|||THANKS!
--
New SQL Server DBA
"Mike Epprecht (SQL MVP)" wrote:

> Hi
> EXEC sp_cycle_errorlog
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Newbie" <Newbie@.discussions.microsoft.com> wrote in message
> news:29D176A0-3569-437D-8F87-7E68DF978AF7@.microsoft.com...
>
>

How to approach (Trigger-Stored procedure )

Hi All

I need opinions on how to approach my task.
I currently have 3 tables: the master table, the archive and a temp
table.
MASTER: has 3 fields ProductID and ProductNo and Released
ARCHIVE: Has 3 ProductID, ProductNo, SoldDate
TEMP: ProductID, ProductNo, SoldDate

I have a trigger on the master table upon deletion to archive. This is
triggered from a seperate routine from a vb app to delete a record
real time.

CREATE Trigger Archive_Proc On dbo.MASTER
For Delete
As
Declare @.iDate As DateTime
Set @.iDate = GetDate()

If @.@.RowCount = 0 Return
set Nocount on
Insert Into ARCHIVE(ProductID, ProductNo, SoldDate)
Select ProductID, ProductNo, @.iDate from deleted

My problem is that I have a temp table that gets filled from a
seperate transaction.It needs to be matched against the master table
then deleted at both master and temp. but the issue is that the temp
table contains its own SoldDate value that needs to be archived.

Q 1: if I use a stored proc. how do i pass the SoldDate value to the
trigger as Triggers dont use GVs.
Q 2: How do I set up the stored procedure to delete with multiple
tables. I can get it to UPDATE but not delete...

CREATE PROCEDURE COMPARESOLD
@.Pool Smallint
AS
Set NoCount on

Update MASTER
Set Released = 2
From TEMP, MASTER
Where TEMP.ProductNo = MASTER.ProductNo
AND TEMP.ProductID = MASTER.ProductID
AND INVENTORY.Released = 1

hopefully someone can lead me to the right direction...
ThanksHi

I have not picked up the exact relationship between temp and the Master
table. Posing correct DDL (using the scripting options in Enterprise Manager
or the QA Object browser) and example data as inserts statements go a long
way to remove this sort of ambiguity.

It seems that you should have a FK from the TEMP table to the Master that
cascades on delete.

It may also be possible to change the trigger so that it picks up the
SoldDate from TEMP such as:

Insert Into ARCHIVE(ProductID, ProductNo, SoldDate)
Select d.ProductID, d.ProductNo, ISNULL(t.SoldDate,@.iDate)
from deleted d LEFT JOIN Temp t on d.ProductID = t.ProductID

You may want something slightly different if there are multiple TEMP
records.

John

"Alvin" <josesievert@.earthlink.net> wrote in message
news:cc27243c.0311061338.45d42f52@.posting.google.c om...
> Hi All
> I need opinions on how to approach my task.
> I currently have 3 tables: the master table, the archive and a temp
> table.
> MASTER: has 3 fields ProductID and ProductNo and Released
> ARCHIVE: Has 3 ProductID, ProductNo, SoldDate
> TEMP: ProductID, ProductNo, SoldDate
> I have a trigger on the master table upon deletion to archive. This is
> triggered from a seperate routine from a vb app to delete a record
> real time.
> CREATE Trigger Archive_Proc On dbo.MASTER
> For Delete
> As
> Declare @.iDate As DateTime
> Set @.iDate = GetDate()
> If @.@.RowCount = 0 Return
> set Nocount on
> Insert Into ARCHIVE(ProductID, ProductNo, SoldDate)
> Select ProductID, ProductNo, @.iDate from deleted
>
> My problem is that I have a temp table that gets filled from a
> seperate transaction.It needs to be matched against the master table
> then deleted at both master and temp. but the issue is that the temp
> table contains its own SoldDate value that needs to be archived.
> Q 1: if I use a stored proc. how do i pass the SoldDate value to the
> trigger as Triggers dont use GVs.
> Q 2: How do I set up the stored procedure to delete with multiple
> tables. I can get it to UPDATE but not delete...
> CREATE PROCEDURE COMPARESOLD
> @.Pool Smallint
> AS
> Set NoCount on
> Update MASTER
> Set Released = 2
> From TEMP, MASTER
> Where TEMP.ProductNo = MASTER.ProductNo
> AND TEMP.ProductID = MASTER.ProductID
> AND INVENTORY.Released = 1
>
> hopefully someone can lead me to the right direction...
> Thanks