Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

create report with date suffix Expand / Collapse
Author
Message
Posted Monday, January 07, 2013 5:15 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: 2 days ago @ 2:38 AM
Points: 79, Visits: 420
I need to create a report & run weekly to output to file on server with filename_date×uffix.txt.

The original report (which is just procedure output) runs as a job.

For security reasons, xp_cmdshell is disabled & I can't invoke a cmd script from jobs (to pop a suffix onto the end of the filename).

What is the best & simplest way to do this?

Thank you.

:)

2005 sp4 ent
Post #1403555
Posted Tuesday, January 08, 2013 5:08 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 9:25 AM
Points: 7,070, Visits: 12,523
Is PowerShell installed on the server? You could do this in a CmdExec step type:

%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -Command "& {$x=(Get-Date -Format "yyyyMMdd_HHmmss");Move-Item -Path "C:\@\FlatFile.txt" -Destination "C:\@\FlatFile_$x.txt"}"

Just change yyyyMMdd_HHmmss to match the timestamp format you want (see the options here) and the two paths to match your environment.



__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato

Believe you can and you're halfway there. --Theodore Roosevelt

Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein

The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein

1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
Post #1404500
Posted Tuesday, January 22, 2013 3:37 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: 2 days ago @ 2:38 AM
Points: 79, Visits: 420
Hi, I'm sorry I forgot to say thanks.

That's great. It's quite restricted where I work so we don't have ps on this server but I've been able to link it to another server that does & use your idea.

I thought there would be a less convoluted way that going server to server for me, but, given the restrictions I have ... this way works so thank you.

:)


Post #1409899
Posted Tuesday, January 22, 2013 4:07 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 9:25 AM
Points: 7,070, Visits: 12,523
You're quite welcome. Thanks for posting back.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato

Believe you can and you're halfway there. --Theodore Roosevelt

Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein

The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein

1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
Post #1410290
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse