Question On Getting The Date Value Into A Filename

Dec 18, 2006

I am running the following sqllitespeed backup script on Windows 2003 Server
against SQL Server 2000



sqllitespeed -Bdatabase -T -DNorthwind -FH:MicrosoftSQLServerBACKUPSDATABACKUPSNorthWi nd
orthwind.bak


How could I place the date variable into the output filename?

I've tried variations of %date% etc but nada.

Any thoughts?

Thanks in advance.

Gerry

View 3 Replies


ADVERTISEMENT

Retrieve Date From Filename

Apr 29, 2006

Hye all,

I need help on this.

Let say my source file in excel format. Currently i'm using foreach loop to execute those source files. The problem is that , i want to retrieve a date from the source(filename) itself. i've tried using derived column. but it doesnt work.

eg: Source file name Email_Jan_05.xls, i want to grab the string JAN and 05 which later i'm going to put it in my database.

any suggestion? Thanks in advance.

View 4 Replies View Related

Putting The Date And Time In A Log Filename

Mar 11, 2008

Here's what I want:
I have a DTSX package run as a SQL Server agent job, that each time it runs I want it to create a new log file with the date & time in the filename.
e.g. MyJobLog.20080311_103613.txt

I have implemented this using the SSIS log provider for Text Files, and defining the Connection String as an expression as follows:-




Code Snippet"MyJobLog." + (DT_STR,4,1252)YEAR( DATEADD( "dd", -1, getdate() )) +RIGHT("0" + (DT_STR, 2, 1252) MONTH( GETDATE() ), 2) +RIGHT("0" + (DT_STR, 2, 1252) DAY( GETDATE() ), 2)+ "_" +RIGHT("0" + (DT_STR, 2, 1252) datepart("hh", GETDATE() ) , 2)+RIGHT("0" + (DT_STR, 2, 1252) datepart("mi", GETDATE() ) , 2)+RIGHT("0" + (DT_STR, 2, 1252) datepart("ss", GETDATE() ) , 2)+".txt"






Here's the problem:-
When the job runs, each time it tries to write to the log file it re-evaluates the filename, and as the seconds pass by the name changes! So instead of one file I end up with several:-
e.g.
MyJobLog.20080311_103613.txt
MyJobLog.20080311_103614.txt
MyJobLog.20080311_103615.txt


So the one execution of the job is now divided across three files! This is not what want!

Here's one way I fixed it:-
One of my Jobs is run from an MS-DOS batch file, so I was able to pass the constructed date/time sting into the DTSX file as a parameter. This works perfectly.

Here's my problem:-
Three more of my jobs are run as scheduled job from SQL Server Agent, so I can't pass in the date/time as a parameter each time (unless you know otherwise). And the clients' security policy won't allow the job to call an MS-DOS batch file which runs the DTSX package.
Or is there really some other way to stop the Log filename from re-evaluating on every write?


View 8 Replies View Related

Adding Date To Filename In Report Subscription

Apr 26, 2007

My company sends reports on a daily basis to our customers. Now I want to save all the sent reports on disc with the date in the filename. I have set up a subscription which daily saves the files where I want them. However, I haven't found a way to add the date easily. I already have a parameter when creating the report, it is called Date. Does anybody know if I can use a parameter or something else?



Thank's

View 10 Replies View Related

Integration Services :: Expression To Parse Filename To A Date

Aug 7, 2015

I am very new to SSIS.  I need a package to iterate through files in folders and subfolders, evaluate the date of the file and delete them if they are over 90 days. I am using the following as a guide.  The reason I am not using a maintenance plan for this is that I did not see a way to use a built in maintenance plan task to copy files.  I already built a package that copies files to the destination.  Now I need to delete files in the destination that are over 90 days old.  

[URL] ...

I have a File System Task to delete files. I have a Script Task with a precedence constraint where I need to build an expression on the constraint between the Script Task and the File System Task for the delete.  

I have database backups in the format of SQLInstanceName_DatabaseName_BackupType_YYYYMMDD_XXXXXXX.bak.  

I created a variable to store the filename and I need an expression that will convert a file name like :

MySQLInstance_MyDB_DIFF_20150803_1700000.bak into 20150803, compare it to getdate -90 days.  

I created another variable for the Max File Age.  I built the below but when I click on Evaluate Expression I get an error stating, "The expression might contain an invalid token, an incomplete token, or an invalid element." 

DATEDIFF("dd",(DT_DATE)(SUBSTRING(RIGHT( @[User::strFileName], 20 ),1,8), GETDATE()) >  @[User::intFileMaxAge]

View 5 Replies View Related

Adding Current Date Into Attachment Filename In Reporting Service

May 30, 2006

Hi there,

I have been using reporting service to generate my report and sending email with attachment report via subscription everyday. It is work well and no error.

My attachment file name is as same as reportname project. But customers asked me to add current date into an attachment filename which will help them to identify the report. I try to check in rsreportserver.config to change it but have no idea.

My reportname project is daily_file.rdl and my attachment filename in email is daily_file.csv. I'd like to change my attachment filename as day_month_year_file.csv.

Is there anyone know how to change an attachment filename to be not the same as reportname in reporting service 2005

Regards,

View 3 Replies View Related

How To Concatenate Variables For RAW Output Filename I.e.@path + @filename?

Sep 7, 2007

Doesn't appear you can do this.

Am I wrong?

Please tell me I am.

View 11 Replies View Related

SSIS Execution Error: FlatFile Connection Problem - FileName &&<fileName&&> Specified In The Connection Was Not Valid.

Apr 19, 2008



Hi Champs,

Scenario Configuration : VB.net 2005 Code, WebService for Executing SSIS on Server, SSIS deployed on the Database Server

Problem Description : We are developing windows applicaiton in which we call webservice which was deployed on the same server where SSIS packages are deployed.
Now from Code we are passing FilePath name in variable and execute the Package. But the SSis result says that
The file name "\computernamefol1fol2fol3fol4abc.txt" specified in the connection was not valid.

More Information:

1. Full Permission are given on this network folder.
2. Package executes successfully from SSIS development solution (BIS solution)
3. Deployed packed executes successfully from the Database Server.
4. From Development pc packege executes successfully.
5. Other packages deployed on the same server executed suucessfully with same configuration and scenario.

Only this package is not executing.


-- the only differece with this package with other is -

using ".txt" extension in Flat file connection and using VB Script task


Can any one suggest the appropirate solution for this problem...

Thanks
Tarang Pandya

View 21 Replies View Related

Use A DTS Package To Create An Excel, Which Has In The Filename The Date The Package Is Ran

Dec 19, 2006

I am trying to create a DTS Package which will run a SQL query and export the results to an Excel file.  I would like to the name of the excel to be "dynamic".  What I would like is for the name to be ChronicDownSiteReport - mmddyy.xls.  The mmddyy is the date which the package is executed.
 How can I do this? 
Also, I want this package to be excuted at 1am every Sunday Morning.  I have attempted to schedule this to run, but when I come to work on Monday, the excel file is not present and the email, which is sent telling me that the file was created is not in my mailbox. 

View 2 Replies View Related

Get Just Filename

May 23, 2008

If you use "SELECT filename FROM sys.sysdatabases" this will return
the full path , such as "E:MSSQLdatamyData.MDF" ,

is it possible to return just the "myData.MDF" part of it?
I know that you can parse the string , but is it stored somewhere else , or is there a command that will return just the physical file name ?

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com

View 1 Replies View Related

Add Seq# To Filename

Mar 25, 2008

Hi Guys, got a question that I'm not sure there is an answer to other than 'No Way'.

I have to export a file whose filename must include a sequence number. I have created the table to hold the seq# and the code to increment it. My problem is how do I include the seq# in the output filename. I am using the Flat File Destination tool for exporting. should I be using another tool?

Any suggestions?

Thanx,
Trudye

View 2 Replies View Related

Logical Filename

Jun 19, 2002

Hello,

Is there any way to change the logical filename of exsiting database

Thanks
Lara

View 1 Replies View Related

Getting FILENAME Into @variable In SQL

Oct 10, 2001

Does anyone know how to execute a directory listing of a file and return the file name to a variable in SQL? For instance, there's a file called c:datach20011010.txt and i execute the following:
xp_cmdshell 'dir  c:datach*.txt'

or any other transact sql or procedure, how can i get the filename into a variable...all in sql?

FYI - I need to pass a filename to a process so that it can bcp the data into a temp table. But I don't know the filename at the time the process is setup/scheduled.

TIA,
Mike Nolen

View 3 Replies View Related

Get Filename Dynamiccaly

Jul 26, 2007

Hi,
I am using a foreach loop to go through the .txt files inside a folder.
Using a variable I can pickup the filenames the loop is going through.
At present there is a sql task inside the foreach loop which takes the filename as a parameter and passes this filename to a stored procedure.
Now I would like to add one extra step before this sql task. Would like to have a dataflow with flatfile source which connects to oledb destination.

The question is:
While in the loop, how is it possible to pass the filename to the flatfile source using the FileName variable which I have created?

Please note, this is a different question to my other post.

Many Thanks

View 1 Replies View Related

Ssis - Filename

Jul 26, 2007

Hi,
I think I may have mis-guided some of you in my previous post.
So I thought I explain it properly this time in a new post...

Here is the description of the ssis package:

Inside the connection manager there is a connection to the sql server database and a flat file connection.

The flat file connection inside the connection manager has the expression set
i.e. ConnectionString set to @[User::FileName]

And so there is nothing inside the connectionstring property of this flatfile connection.

Inside control flow:

1)

Dataflow which contains a flat file source and an ole db destination

The flatfile source is supposed to pickup the .csv file that gets passed to the ssis package.
Then the ole db destination is where the .csv gets imported into a sql server table.

2)

Back in the control flow, there is a task that calls a stored procedure with the parameter which is set to FileName

The question is:
How does this FileName parameter gets set before it is passed to the stored procedure?

Many thanks

View 1 Replies View Related

How To Read Filename

Mar 28, 2008

HI,

I am writing data from a file in to a table and i have a field in that table for filename. How to read the file name to write in that table.

Thanks in advance.

View 4 Replies View Related

Get Filename Dynamically

Jul 26, 2007



Hi,
Using a ssis package I have several tasks.
A variable is also created called FileName.
There is a flat file connection called InputFileName.
initially when I designed the package, I hardcoded the pass of one of the .csv files into the path of the flatfile connection.

There is a dataflow which has flatfile source and oledb destination. These two basically pickup the file and import into the database using mapping.

So therefore the package works and data gets imported into the database.

Then I used the variable to make the filename dynamic. So I removed the hardcoded connectionstring in the InputFileName.

Is this the right thing to do to make the package dynamic? I would like to pass in any .csv filename and so the package runs.
My question is now that the connectionstring is deleted but instead placed an expression for the filename, then how does the system know which file to use?

Thanks

View 1 Replies View Related

Pass Filename

Jul 11, 2007

Using SSIS foreach loop I get the files names inside a folder on the network.
How do I pass this variable i.e. file name to a stored procedure?
Thanks

View 9 Replies View Related

Looking For A Filename With A Certain String

Feb 27, 2008

Hi, I want to get my SSIS package to look for a file in a named directory that has a ceratin string in the filename.
example - My file is in a folder called data and the filename is 'System_UT_INCR_BOOKINGHEADER_20080214000000.TXT' Every day the fiel name changes to reflect the current date. I need my package to search for the String "BOOKINGHEADER". I know I need to create a variable with that value but I am not sure (using the example below) how to write the code to do this.




Imports System.IO

Imports System

Imports System.Data

Imports System.Math

Imports Microsoft.SqlServer.Dts.Runtime

Public Class ScriptMain



Public Sub Main()

Try

File.Move(Dts.Variables("Source").Value.ToString, Dts.Variables("Destination").Value.ToString)

Dts.Events.FireInformation(0, "", "File Moved Succesfully", "", 0, True)

Catch ex As Exception

Dts.Events.FireError(1, "", "Source file or destinations does not exist", "", 0)

End Try

Dts.TaskResult = Dts.Results.Success

End Sub

End Class

View 3 Replies View Related

T-sql Check A Filename

Sep 11, 2007

I take a backupfile every night and its named like 20070911_xvall.bak.
Now I need a procedure for an automatic restore in another sql server but I have to do a check to se that the date of the backupfile is the same as actual date so it can¨t happened that an older backupfile being restored.
Is it a good way to take actual date och build up the wanted filename and how can I then check if the file exist, its stored on another computer?
Anyone who has some sample I can start with?
Thanks

View 10 Replies View Related

Filename In Subscription

Feb 15, 2006

Hello,

I have a question regarding the report file which is included in an email, when a subscription is created:

Is it possible to programmatically add something to the name of the created file of the subscription? I want to have one parameter of the report, which is a date, added at the end of the filename to let the clients distinguish between different report files.

Thank you in advance.

Sandra Geisler

View 2 Replies View Related

Filename In SSIS

Apr 28, 2008

i have four text file which comes in different format , one of the fields i need to generate is the source Filename without extension as one of the coloums in the target tables.

The name of the file is requirment in the destination, how could i read the file name of the text file source and make it a coloumn and insert it into target.

Please advise



View 12 Replies View Related

The Database Filename Can Not Contain The Following 3 Characters: [ ] And '

Aug 3, 2006

How do I correct this error: 
"The database filename can not contain the following 3 characters: [ (open square brace), ] (close square brace) and ' (single quote)" ?
Where is the database stored and/or how can I change the relevant settings?
I have Both Visual Web Developer Express and SQL server express.
Exception detail:
System.Web.HttpException was unhandled by user code  Message="The database filename can not contain the following 3 characters: [ (open square brace), ] (close square brace) and ' (single quote)"  Source="System.Web"  ErrorCode=-2147467259  StackTrace:       at System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString)       at System.Web.DataAccess.SqlConnectionHelper.EnsureSqlExpressDBFile(String connectionString)       at System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation)       at System.Web.Profile.SqlProfileProvider.GetPropertyValuesFromDatabase(String userName, SettingsPropertyValueCollection svc)       at System.Web.Profile.SqlProfileProvider.GetPropertyValues(SettingsContext sc, SettingsPropertyCollection properties)       at System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider)       at System.Configuration.SettingsBase.SetPropertyValueByName(String propertyName, Object propertyValue)       at System.Configuration.SettingsBase.set_Item(String propertyName, Object value)       at System.Web.Profile.ProfileBase.SetInternal(String propertyName, Object value)       at System.Web.Profile.ProfileBase.set_Item(String propertyName, Object value)       at System.Web.Profile.ProfileBase.SetPropertyValue(String propertyName, Object propertyValue)       at ProfileCommon.set_MyNewProperty(String value) in c:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Fileslesson04385e3cebf08b8b90App_Code.jqcpv0qn.0.cs:line 24       at _Default.Page_Load(Object sender, EventArgs e) in D:Daniel's DocumentsVisual Studio 2005WebSitesLesson04Default.aspx.vb:line 15       at System.Web.UI.Control.OnLoad(EventArgs e)       at System.Web.UI.Control.LoadRecursive()       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Thanks in advance
 

View 3 Replies View Related

Store A Filename In A Database

Dec 13, 2006

how can I  store a filename in the database, i have some GIF files which i want to show up on report, how can i specify those filename with a path in the database.
i tried manually entering the path c:Dataimages.gif but it didnt work. Can someone pls tell me how to do it.
 
Regards,
Karen

View 5 Replies View Related

Inserting Filename Into Database

Mar 7, 2008

I have a page called 'upload.vb', which is the code for a file upload project I am working on.  I am trying to write the filenames to an SQL database that I have built, but I keep getting this error: Compiler Error Message: BC30201: Expression expected. It doesn't seem to like the @ on line 46 in the VALUES part of my INSERT statement. Can anybody shed any light on this. Thanks.  1 Imports System
2 Imports System.Data
3 Imports System.Configuration
4 Imports System.Web
5 Imports System.Web.Security
6 Imports System.Web.UI
7 Imports System.Web.UI.WebControls
8 Imports System.Web.UI.WebControls.WebParts
9 Imports System.Web.UI.HtmlControls
10 Imports System.IO
11 Imports System.Data.SqlClient
12
13 ''' <summary>
14 ''' Upload handler for uploading files.
15 ''' </summary>
16 Public Class Upload
17 Implements IHttpHandler, IReadOnlySessionState
18
19 Public Sub New()
20 End Sub
21
22 #Region "IHttpHandler Members"
23
24 Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable
25 Get
26 Return True
27 End Get
28 End Property
29
30
31
32 Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
33
34 If context.Request.Files.Count > 0 Then
35 ' get the applications path
36 Dim tempFile As String = context.Request.PhysicalApplicationPath
37 ' loop through all the uploaded files
38 Dim j As Integer = 0
39 While j < context.Request.Files.Count
40 ' get the current file
41 Dim uploadFile As HttpPostedFile = context.Request.Files(j)
42 ' if there was a file uploded
43 If uploadFile.ContentLength > 0 Then
44
45 uploadFile.SaveAs(String.Format("{0}{1}{2}", tempFile, "Uploads", uploadFile.FileName))
46 SqlDataSource.InsertCommand = "INSERT INTO tblDocuments(TheFileName) VALUES ('" & @TheFileName & "')"
47
48 End If
49 System.Math.Max(System.Threading.Interlocked.Increment(j), j - 1)
50 End While
51 End If
52 ' Used as a fix for a bug in mac flash player that makes the
53 ' onComplete event not fire
54 HttpContext.Current.Response.Write(" ")
55 End Sub
56 #End Region
57
58 End Class
    

View 10 Replies View Related

How To Load XML From Filename And Path

Sep 6, 2005

Hi,
I have inherited a database that has a table called "Resources" that contains a field called "FilePath". FilePath is a VarChar(100) and contains the server path and filename of an XML file on the server hard disk.
I need to join the data in the XML with rows in the "Resources" table (and other tables).
Is it possible to get a Stored Procedure to load the XML file into a temporary table?
Is loading it into a table the best way to do it - or can I join directly to the XML file somehow?
What is the best approach? (I know nothing about XML in SQL Server yet)
Thanks in advance,
Chiz.

View 3 Replies View Related

Using Other Columns To Populate Filename...

Feb 23, 2006

Basically like the topic says, I need to populate a filename with data from other columns and im having a tough time doing it.

Code:


UPDATE nice_cls_calls_0027
SET vcarchivepath = 'G:Nice Storageicestorage.safeautonet.netSafe Auto Task - Logger (807101)2006_feb_1SC_807101_'start_time'_'=stop_time'_'=channel'_'=cls_call_id'.aud'


I need start_time, stop_time, channel, and cls_call_id to populate the filename. The first 2 are datetime fields in the db and no conversion is needed for them, just raw data. The remaining two are smallint and raw data is needed there also. Any help would be greatly appreciated. TY

View 4 Replies View Related

Changing Source Filename In DTS

Dec 15, 2005

Hi!

Is there a way I can make the source file in my DTS dynamic so that every time I run it using ASP I can tell it which file to use?

View 1 Replies View Related

Using DTS .. Dynamic Dest Filename

Jan 30, 2006

I need to use DTS to create a dynamic destination filename based on the value of a field. I tried creating a DTS package using the wizard. It works fine if I wanted a static filename for the destination filename. I tried creating a Dynamic Properties Task by selecting Connection2/OLEDB Properties/Data Source and then using a SQL Statement to return a value for the name of the file. It doesn't seem to run the query everytime the DTS is ran. The first time I run it it names the file correctly but after that it keeps naming the file the old value from the SQL statement. Any idea what I need to do to fix this?

View 5 Replies View Related

Extracting Filename From Path

Nov 8, 2013

I have to extract only the filename from the below filepath.

The first part prodserverexport always remains the same. A new folder is created prodserverexport 20071001, prodserverexport 200710012 etc each time the file is dropped . I want to extract only the part after that namely 20071001-200001-e430f8fd-PREC272.wma and like wise and dump it into a table.

prodserverexport2007100120071001-200001-e430f8fd-PREC272.wma
prodserverexport2007100220071002-013203-d00b2007-PREC120.wma
prodserverexport2007100220071002-032038-18381b92-PREC207.wma
prodserverexport2007100820071008-144758-16359a7b-PREC224.wma
prodserverexport2007100920071009-170426-4ed3535c-PREC97.wma

View 7 Replies View Related

Updating Field But Not Filename

Jan 22, 2007

I want to change the following field in the database - text field.

Want it to be like this,

C:ProgramFilesHEATHEATSelfServiceattachmentsWinter019997.htm

want it to be H:2007Winter019997.htm

My aim is to move the files from C: to H: drive and update the database to reflect this. Thanks

Thsi is my code;

declare @str varchar(1000)
UPDATE heatgen
set @str = 'c:Program FilesHEATHEATSelfServiceattachmentsWinter019997.htm'
select reverse(@str)
select charindex('', reverse(@str))
select right(@str, charindex('', reverse(@str)))
select 'H:2007' + right(@str, charindex('', reverse(@str)))

SET gdetail = 'H:2007' + RIGHT(gdetail, CHARINDEX('', REVERSE(gdetail)))

The field is text I get error

Line 9: Incorrect syntax near '='.

Thanks.

View 19 Replies View Related

Variables Holding Filename

Feb 8, 2007

I already posted this question in the Wrong Forum.

However I was wondering if it is possible to create a variable that holds the filename as an expression. I am using a For each loop to pick up files and i want to insert the 'Filename' as a colum so that i can differentiate among the rows in my destination Table.

Using the 'Derived Colum' in DTS I can link the colum to the variable. However i do not know how to create the variable which will store the filename for each file....

Any Clues...
Would really appreciate the help.....

View 2 Replies View Related

How To Read A Filename Into A Variable

Jan 14, 2008

I'm trying to read the filename from a file that I'm downloading by FTP (FTP Component) into a string variable so I can later use it for another part of the process, how can I do this?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved