Get File Create Date And Time From Within SSIS
Oct 4, 2006The subject line says it all. I need to be able to do a comparison on a file's date and time to see if it is stale or not.
View 15 RepliesThe subject line says it all. I need to be able to do a comparison on a file's date and time to see if it is stale or not.
View 15 RepliesThis is driving me nuts..
I'm trying to extract some data from a table in oracle. The oracle table stores date and time seperately in 2 different columns. I need to merge these two columns and import to sql server database.
I'm struggling with this for a quite a while and I'm not able to get it working.
I tried the oracle query something like this,
SELECT
(TO_CHAR(ASOFDATE,'YYYYMMDD')||' '||TO_CHAR(ASOFTIME,'HH24:MM : SS')||':000') AS ASOFDATE
FROM TBLA
this gives me an output of 20070511 23:06:30:000
the space in MM : SS is intentional here, since without that space it appread as smiley
I'm trying to map this to datetime field in sql server 2005. It keeps failing with this error
The value could not be converted because of a potential loss of data
I'm struck with error for hours now. Any pointers would be helpful.
Thanks
I am trying to load previous days data at 3 am via a SSIS job.
The Date variable is initiated as DATEADD("dd",-1, GETDATE()) in the for loop.
Now, as this job runs at 3 am, and I set the variable as GETDATE() - 1, it excluded the data from 12 am to 3 am in the resultset as Date is set as YYYY-MM-DD 03:00:00:000 I need this to be set as YYYY-MM-DD 00:00:00:000
How can i do this?Â
Is there aan easy way to create these dimensions in sql 2005?
Thanks
hi i have question
can sql server know when the row in table Saved CREATE TRIGGER date time on the ROW ?
add new field call "date_row_save" date+time
inside the the sql server
i need to know whan the row Saved
is it possible to do this in TRIGGER ?
TNX
what would be the TSQL in trying to create a new table with date-time format ending via a select into like:
select
*
into tblResults_
+
SELECT
CONVERT(VARCHAR(10),GETDATE(),112)
+
'_'
+
REPLACE(CONVERT(VARCHAR(10),GETDATE(),108),':','_')
from qryResult
Hi all
i build package with error output .
current situation i create file .txt and conf. error flow to redirect rows and write the rows in the file
what i need create autometed file every time package executed contains all rows , named of the execution date ime
thanks & Regards
I have two columns in Informix data base One has Data Type of date and another column of data type string.
Time is stored in string format. I have to Validate wether both are correct, not null, greater than 1753 and concate to get one datetime field to transfer to SQL Server.
Right now I am doing it in script component, as I need to log error if any thing is wrong
Is there any better way to do it,(derived column or any other component) so that I can log the error also.
Thanks
Dharmbir
Hello all. I was just wondering how I could add the current date and time to the name of the .bak file. I perform a full backup daily and would like to keep a weeks worth of backups, but everytime I run the job, it just overites the previous one.
The command in the wizzard is:
BACKUP DATABASE [snl] TO DISK = N'C:Backups_for_FTPSNL_Full.bak' WITH NOINIT , NOUNLOAD , NAME = N'snl backup', SKIP , STATS = 10, DESCRIPTION = N'SNL Backup', NOFORMAT
Thanks,
Parallon
We have an application group that wants to pull date from SQL Server and write it to text file on the server. They want the file format to be 12100_YYYMMDDHHMM.fr1 for one set of data, 12100_YYYMMDDHHMM.fr2 for a second set...and so on. The '12100' is fixed, but the rest of the file name will always have to include the system date/time. Is there an easy way to do this within a DTS package (when writing to the output file)? I would really appreciate help on this. Thank you.
View 1 Replies View RelatedHi
I am trying to move a flat file to an archive folder and then rename the file to include the date and time of runtime.
I have set up a File System Task to move the file which works fine and a second File System Task to rename. The IsDestinationPathVariable is set to TRUE and the DestinationVariable is called User::Error_Log_File_Rename. There is an expression as follows:
@[User::Error_Log_File_Rename] = "Y:\SSIS_PUD_Upload\Error_Log_Archive\Update_Error_Messages - " +REPLACE((DT_WSTR, 30)(DT_DBDATE)GETDATE() + "-" + (DT_WSTR, 30)(DT_DBTIME)GETDATE(),":","-") +".txt"
which is the required file name.
If I go into the expression and evaluate it it will give me the current date and time. However when I run it as part of the package say 10 minutes later the file is renamed using the same date and time from 10 minutes before when I evaluated the expression. If I wait another 10 minutes and run the package again it still retains the original date and time.
Is there a way to get the expression evaluated with the current date and time during execution of the package?
Thanks in advance
Scott
HOW TO GET A FILE'S CREATE DATE??
From SqlServer I need the create date of a file on C or D.
Is there a function or code to retrieve the create date,
or an API that could read and pass back the file's creation date???
How can I get file created date of a text file using TSQL.
Thank You
Nad
Hi,
I would like to know as to how can I put a Current Date & Time stamp on a FILE NAME automatically which is created by a DTS package.
E.g. I create a file named ABC.TXT daily. How do I get this file to have the current Date stamp so that the file name is ABC121201.TXT without any user intervention.
Thanks for the help!
I am getting below errors when I try to import data from csv format to a sqlserver table.The csv file has date column that has date with format: 7/10/2015 Â 1:18:39 PM and the sql server is using datetime not null for that field in the table.
[OLE DB Destination [90]] Error: SSIS Error Code DTS_E_OLEDBERROR. Â An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Â Source: "Microsoft SQL Server Native Client 10.0" Â Hresult: 0x80004005 Â Description: "Invalid date format".
[OLE DB Destination [90]] Error: There was an error with input column "Date" (138) on input "OLE DB Destination Input" (103). The column status returned was: "Conversion failed because the data value overflowed the specified type.".
I am trying to load a table from MS Access into SQL Server. The Table has several columns defined as Date/Time. When I define the transform I get an error saying that the conversion between DT_DBDATE and DT_DBTIMESTAMP is not supported.
How do I get around this?
We are using an ADO.NET provider in SSIS to read data from a SQL Server 2000 table that contains DateTime columns to write to a Flat File Destination. When the date values are written to the file they are formatted in TimeStamp to the 10th decimal position; e.g.€œ2006-04-24 12:00:00.123000000€?. Since SQL Server supports values to Timestamp(3), we need to truncate the last seven zeros to put the data in this format €œ2006-04-24 12:00:00.123€? to keep the file as small as possible.
Since we have several hundred DateTime columns in scope for our requirements we are looking for the least logic/effort to accomplish this task. We can do this via Data Conversion and Derived Column transformations to cast the dates and strings but it is very labor intensive. It would be something like singing 99 bottles of beer on the wall eight times in a row with each verse taking 3 minutes each. Yikes.
We have tried casting the DateTime columns to varchar in the SELECT statement but receive this format €œApr 24 2006 12:22PM€?.
Is there a configuration we've missed that forces timestamp(10) with non significant digits?
Hi ,
I need to create a CSV file by reading a table data , Can any one know how i can do this using SSIS .
My Requirment is that -
I have a temp table in which i inserted all the incorrect data during the load of a flat file using SSIS. Now i need to write all the incorrect data of the temp table in a CSV . Is there is a way i can do this using SSIS , Please help as i am new to SSIS.
Regards,
Ashish Soni
Hi,
i am dev new project which will be having 10 packages which can be having many source conn mgrs (flat file connection managers).
usually we will give file path when creating filat file conn manager. like that i many do for all packages.
when package is executed it searches for that file path in conn manager and file get execute where data is available normally.
But my req is i have to create file (say xml) where the path of folder(bec all the files which are used by all packages will be available in the same folder) should be available.
so server while executing package it has to search that xml first where it should find the path of the file and finally file has to be executed.
how can i acheive that req.plz guide me
Hi All,
any suggestion on creating date time stamped files names for backup file.
I want to create new file for daily backups with date time stamp so i can use Maintenance plans to clean older files in each 4 month cycle.
thanks,
As part of my package, i require a date (Only date, not DateTime) which is 10 months previous to get date.Eg: for today if the package executes, then i want 12/1/2014 , which i will use in my package as a filter like 'where date='?' where ? is a paramter which is is derived from the above logic
So, I have a project parameter @ppdate with value as  -10. I create a variable with DateTime (because there is NO date type for SSIS) and gives the expression as below
dateadd("Month",@ppdate, DATEADD("D",-(DAY(GETDATE()))+1,GETDATE())) , I am getting '7/1/2011 11:33:38 AM' which i don't want - i want only '12/1/2014'. How can i get it?
To get '12/01/2014', Â If i change the variable from DateTime to string, then i think i cant use the value in the filter condition like ''where date='?' because this does not accept string. Is this correct?
Hi,
I have a package that writes information to a table in sql server 2005. I created an Excel file called ErrorLog.xls with column headers:
AccountNumber and Date.
I have a Data Flow Task that inserts from SQL into the Excel File.
This works fine the first time.
However, I then want to rename the Excel File, delete and recreate it with just the column headers AccountNumber and Date.
I need the Excel file to be empty every time the package runs.
I am able to create an Excel File using Script Component but how can I also add the headers?
Thanks
Whisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much.
I have two views, a list of groups and a list of group members keyed by group ID.
I want to create a flat file, via SSIS, that will give me a basic structure of (this is pseudo LDIF):
groupID: 12345
desc: description of group 12345
chagetype: add
member: <dn of member1>
member: <dn of member 2>
groupID: 12346
desc: description of group 12346
chagetype: add
member: <dn of member1>
member: <dn of member 2>
member: <dn of member 3>
.
.
member: <dn of member 12>
How do I do this via SSIS?
I'm a developer, but don't have a lot of SSIS package experience, so please use small words... Thanks.
J
Hi,
I am using SQL Server2005 for SSIS. I want to change the source connection dynamicaly evertime.
Let me clear, I have to extract some column from excel to MS-Access. I am using Data Flow Task and able to successfully complete the job. But problem is that, whenever a new file comes , i must have to reconfigure my Excel Source.
All the time column in file are same, so no need to worry about mapping but how can my package select a file automatically.
I have a directory, suppose "C:dpak". I should able to pick the filename and sheet name from this directory every time when my package will execute.
I'm looking for a way of taking a query which returns a set of date time fields (probable maximum of 20 rows) and looping through each value to see if it exists in a separate table.
E.g.
Query 1
Select ID, Person, ProposedEvent, DayField, TimeField
from MyOptions
where person = 'me'
Table
Select Person, ExistingEvent, DayField, TimeField
from MyTimetable
where person ='me'
Loop through Query 1 and if it finds ANY matching Dayfield AND Timefield in Query/Table 2, return the ProposedEvent (just as a message, the loop could stop there), if no match a message saying all is fine can proceed to process form blah blah.
I'm essentially wanting somebody to select a bunch of events in a form, query 1 then finds all the days and times those events happen and check that none of them exist in the MyTimetable table.
I have a select Script as follows:
SELECT c.ABC AS 'ABC'
, a.Qty AS 'Quantity_Recived'
, b.PC AS 'PC'
, b.PC AS 'PC'
, 'I' AS 'Flag'
FROM TNRInventory.dbo.tInventoryAlloc AS a
LEFT OUTER JOIN vwInventoryAllocMapping AS vwMap ON a.TNRAllocTypeID = vwMap.TNRInventoryAllocID
LEFT OUTER JOIN ABC.dbo.ZREFRESHTAB AS b ON a.DispenserID = b.Asset
LEFT OUTER JOIN ABC.dbo.TableJoinKey AS c ON a.TitleID = c.TITLE_ID
WHERE (vwMap.DataSourceID = 3) and vwMap.[DataSourceAllocName] = 'I'
group by c.SKU_NO , vwMap.[DataSourceAllocName],a.Qty , b.Profit_Center
order by c.SKU_NO,vwMap.[DataSourceAllocName]
GO
i have to send the result of aforesaid script in batch of 300 records per file (tab delimited text file)
now the file name must be dynamically created as each file will contain 300 records.
I have found some document related to same issue on this url
http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=1238184&SiteID=17
but still there is a catch.
Can any one guide/suggest me better way to do the aforesaid.
Thanks
CREATE TABLE Test
(
EDate Datetime,
Code varchar(255),
Cdate int,
Price int
);
drop table Test
[Code] ....
I have this Query and the below output:
EDate Code CDate Price
2015-06-24Â Â RXÂ 20150701Â 22
2015-06-24Â Â RXÂ 20150701Â 28
2015-06-24Â Â RXÂ 20150701Â 43
[Code] ....
Now the task is to create SSIS package which will create different .txt file for each Code
1) RX20150624.txt
2015-06-24 00:00:00.000Â RXÂ 20150701Â 22
2015-06-24 00:00:00.000Â RXÂ 20150701Â 28
2015-06-24 00:00:00.000Â RXÂ 20150701Â 43
2) NG20150623.txt
2015-06-23 00:00:00.000Â NGÂ 20150701Â 43
3) HO20150624.txt
2015-06-24 00:00:00.000Â HOÂ 20150701Â 43
And so on..
But the requirement is to have a dynamic query where we can have more number of Codes or less number of codes and similarly the package should generate dynamic text files, one .txt file per code. What is the best way to create a package which can meet the above requirement?
We are in the process of trying to automate our production releases (what a concept ;-)
The database is SQL server 2005
All objects are being stored in VSS
Using Nant and Cruise Control for the actual migrations.
I have two directories - Create (for a brandnew database) and Change (db object changes)
In my 'Change' script, I do the following -
1 - Take backup of database
2 - Migrate objects from 'change' directory to production
3 - Script out all objects of database and save in the 'Create' directory
For the #3, I was hoping I could create an SSIS package that would
script out all database objects and save them on the VSS server.
I'm new to SSIS and want to verify it's something that can be done before I start down that path.
If anyone has any examples or references, it would be much appreciated.
Thanks
Hi All,
I have a dataflow task that creates a text file and posts it in a FTP share.
In need to rename the file attaching datestamp(current date of package execution) at the end of filename.
For ex: My dataflowtask creates a file called 'Samplename.txt'
I need to rename it to : 'Samplename20080225.txt.
I think it can be done using the File task...I see an option to rename the file but not sure of how to configure the task to attach current datestamp.
I see some suggestions online, but complete steps on how to implement the above would be highly appreciated.
Thanks,
I can set the propperty of the checkpoint file to a local drive, but not to a UNC path mapping, mapping to my host server. (loop back)
Example: "I:FILEFILE1$InputArchiveOntwikkel " is possible as checkpoint file property.
S11487O$InputArchiveOntwikkel is not possible, though this is the same folder on the local host.
For data source both unc path and drive mapping are allowed. Why this difference?
I have a Stored proc which on execution, will generate data in the view .
My requirement is using SSIS, how can I create a Flat file pointing to this view ?
I am using vs 2010 and I have an .xls file that I am trying to import into SQL Server 2012, and I have most of it figured out, but I have a date field that is giving me problems, and what I would like to do is put that date in a variable so I can add it to every record in my SQL Table.
I am using a SQL Task Editor with an excel connection and I have no problem getting other data from the excel document and putting into my variable, its just the date that I have problems.
Hi
SSIS is brand new for me.. Playing with since a few hours..
Iam trying to import a Flat File into the SQLSERV DB using SSIS..
One of the column is in this format -- "YYYYMMDDHH24MISS"
How do i get around this to import the data in a readable fashion into the Destination?
Thanks!
MKR