Forum Replies Created

Viewing 15 posts - 2,896 through 2,910 (of 13,879 total)

  • Reply To: Report

    In T-SQL, use sp_Send_DBMail (link) to send e-mails.


  • Reply To: Data Older than 12 month

    John Mitchell-245523 wrote:

    Something like this, which isn't very efficient.  Better to stored your dates as dates if that's an option.

    WHERE DATEADD(MONTH,12,CAST(CAST(data AS char(8)) AS date)) < GETDATE()

    John

    John, I...


  • Reply To: Data Older than 12 month

    You can potentially shortcut John's method. If you add or subtract 10000 to an INT date held as YYYYMMDD, you are effectively adding or subtracting a year.

    (If one of your...


  • Reply To: dbcc traceon(2453,-1)

    MVDBA (Mike Vessey) wrote:

    there are 2 things - historically we've been told to use table variables as they can "sometimes" be in memory (no one has ever given me details on when...


  • Reply To: dbcc traceon(2453,-1)

    This is interesting ... I usually head from table variables to temp tables. Are you finding improvements across the board (ie, for all temp tables), or just in certain scenarios?


  • Reply To: Are the posted questions getting worse?

    Michael L John wrote:

    below86 wrote:

    That's some bad code there Mike.  I've seen some similar, but add a couple UNION statements and all with in an SSRS report.  Talk about slow code.

    I've also...


  • Reply To: Dynamic Subject Line

    The date which appears in your subject will depend entirely on the date on which the job is run. In words: "Give me the date for Sunday of the preceding...


  • Reply To: Dynamic Subject Line

    etvph81 wrote:

    I wasn't sure if running this package weekly if that function would update automatically every week

    GETDATE() updates every time you call it.


  • Reply To: Dynamic Subject Line

    etvph81 wrote:

    Actually for the week of February 23rd

    again I really appreciate the help

    Oops, I meant Feb.

    Change your DECLARE @Sub line as follows:

    DECLARE @Sub NVARCHAR(255)
    ...

  • Reply To: Dynamic Subject Line

    So ... if the job ran today, would you like the subject to be

    'Transfer Report for the week of 23 March to 29 March'

    ?

    • This reply was modified 6 years, 7 months ago by Phil Parkin.
    • This reply was modified 6 years, 7 months ago by Phil Parkin.

  • Reply To: Dynamic Subject Line

    etvph81 wrote:

    Thanks Phil I appreciate it how would I get it to say for the week of 23 to 29th?

    Please define the logic for determining the numbers to use.


  • Reply To: Dynamic Subject Line

    My apologies. This is better:

    DECLARE @FilePath NVARCHAR(MAX) = N'C:\inetpub\ftpuser\WESA\ftpwashingtondc\DCWeeklyEmail\';
    DECLARE @Filenames NVARCHAR(MAX);
    DECLARE @EmailAddress VARCHAR(MAX);

    SET @EmailAddress = '?';
    SET @Filenames = @FilePath + N'dc_weekly' + N'.csv';

    DECLARE @Sub NVARCHAR(255) = CONCAT('Example...

  • Reply To: Dynamic Subject Line

    Modify the line

    @Subject = 'Transfer Report',

    to

    @Subject = CONCAT('Transfer Report for the week of ', CONVERT(CHAR(10), GETDATE(), 101)),

    and see whether that is getting you close to what you need.


  • Reply To: Dynamic Subject Line

    2020-03-04_15-06-42


  • Reply To: Dynamic Subject Line

    When I send e-mails from SSIS, I usually use an ExecuteSQL task which runs sp_send_dbmail (link).

    If you configure this, you have all the control you should ever need.

    If you...


Viewing 15 posts - 2,896 through 2,910 (of 13,879 total)