RE: need help with format to run and output a file

RE: need help with format to run and output a file

 

  

set @TimeStamp = convert(varchar, getdate(),112) +
replace(convert(varchar, getdate(),108),':','')

-Steve Hughes

-----Original Message-----
From: Mordechai Danielov
[mailto:mssqldba-ezmlmshield-x32581361.[Email address protected]
Sent: Tuesday, February 28, 2006 3:16 PM
To: LazyDBA Discussion
Subject: RE: need help with format to run and output a file


Try convert(varchar, Current_Timestamp,110) or convert(varchar,
Current_Timestamp,112). That should be a nice format for a filename.
Anyway
look for convert in BOL and see a table with different options for
converting dates into character strings.

-----Original Message-----
From: Jay Butler
[mailto:mssqldba-ezmlmshield-x10258085.[Email address protected]
Sent: Tuesday, February 28, 2006 2:32 PM
To: LazyDBA Discussion
Subject: Re: need help with format to run and output a file

Change "datetime" to CONVERT( varchar, Current_Timestamp, 120 ). Look in

Books Online for a suitable format. You may want to use REPLACE to
change the dashes, colons and spaces to something a little more file
name friendly.


marie price wrote:
> hello all,
>
> I a trying to run an extract using a job, the file must have the date

> appended to it, any idea on how I can do that?
>
>
> exec master..xp_cmdshell
>
> 'bcp "select id+name + paddress from haltondb.marie.dailyimport"
queryout
> "\\hrpalarm\DailyImport\Dailyimport.txt"+datetime -c -T'
>
>
>
>
> ---------------------------------------------------------------------
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> Website : http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
>
>
>


---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html



---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html



MS Sql Server LazyDBA home page