Forum Replies Created

Viewing 15 posts - 4,351 through 4,365 (of 5,111 total)

  • RE: Code pasting still not 100%

    Steve Jones - SSC Editor - Monday, January 30, 2017 8:54 AM

    Tabs or space in source?

    Spaces.

  • RE: Code pasting still not 100%

    This is what it looks like for me.

    If you compare to the text file, the alignment is completely different. (see image below from SSMS)

    It seems...

  • RE: T-Sql Scripting Help!

    Welcome to SSC.

    Posting your data in a Excel probably isn't going to get you as many responses as you'd like, the best way is to always provide your...

  • RE: Call SQL agent job Via Stored Procedure

    You could check for the status of the job after running:
    IF (SELECT TOP 1 run_status FROM msdb.dbo.sysjobhistory WHERE job_id = '756E4E19-E6CC-4874-A7D7-B3EBE44A09D4' AND step_name = '(Job outcome)' ORDER...

  • RE: Missing Records in Dimension Causing Incorrect Results

    Cube data warehouses relying heavily on foreign keys, I'm surprised that the 2018/2019 years could be entered if they don't exist in your Year Dimension (this implies that you don't...

  • RE: Age as of January 1st

    Does this work?

    DECLARE @Birthday DATE,
       @AsOf Date;
    SET @Birthday = '01-May-1987';
    SET @AsOf = '19-May-2000';

    SELECT DATEDIFF(YEAR, @Birthday, DATEADD(YEAR, DATEDIFF(YEAR, 0, @AsOf),0)) -

  • RE: DATETIME Conversion Error (where none should exist)

    Are you able to provide any sample data which shows the error occurring? There could be a number of reasons the conversion is failing, but without data it's a bit...

  • RE: Exporting multiple rows to 1 CSV column using BCP

    Have you tried wrapping your cities in Quotes?

    City = '"' + STUFF((SELECT ',' + City + CHAR(10)  + FROM ##DATA s WHERE s.District = b.District FOR...

  • RE: SSRS 2016 Error

    I've been having a Google of the problem, which discusses that the issue is due to having a timezone of greater than UTC +00:00, however, this was "resolved" in CU1,...

  • RE: Permission set to allow user to create and manage databases

    The dbcreator role does provide a login with db_owner user permissins on databases they create. Note, however, that it won't give db_owner to other Logins with the dbcreator server role.

  • RE: Finding Within dates

    John Mitchell-245523 - Friday, January 27, 2017 5:22 AM

    Come on, this is a simple syntax error.  You should be able to...

  • RE: Finding Within dates

    CREATE TABLE #Date (DateColumn DATE)
    GO

    INSERT INTO #Date
    SELECT '01-Jan-2017';
    GO

    SELECT CASE WHEN DateColumn BETWEEN DATEADD(DAY,-7, CAST(GETDATE() AS DATE)) AND GETDATE() THEN 1

  • RE: Finding Within dates

    Suth - Friday, January 27, 2017 5:14 AM

    Thom A - Friday, January 27, 2017 5:12 AM

    January 27, 2017 at 5:15 am

    #1925285

  • RE: Finding Within dates

    CASE WHEN DateColumn BETWEEN DATEADD(DAY,-7, CAST(GETDATE() AS DATE)) AND GETDATE() THEN 1
        WHEN DateColumn BETWEEN DATEADD(DAY,-14, CAST(GETDATE() AS DATE)) AND DATEADD(DAY, -7, CAST(GETDATE() AS DATE))...

  • RE: Finding Within dates

    DateColumn BETWEEN DATEADD(DAY-7, CAST(GETDATE() AS DATE)) AND GETDATE() --Would return rows where the DateColumn has a value 20-Jan-2017 to now INCLUSIVE

    DateColumn BETWEEN DATEADD(DAY-14, CAST(GETDATE() AS DATE))...

Viewing 15 posts - 4,351 through 4,365 (of 5,111 total)