Forum Replies Created

Viewing 15 posts - 3,016 through 3,030 (of 10,144 total)

  • RE: Return records that only match set criteria in various tables

    CREATE TABLE #CUSTOMERS (CustomerID INT,CustomerName VARCHAR(20))

    INSERT INTO #CUSTOMERS (CustomerID,CustomerName) VALUES

    (100001,'Mr J Bloggs'),

    (100002,'Mr J Smith')

    CREATE TABLE #POLICIES (PolicyID INT,PolicyTypeID INT,CustomerID INT)

    INSERT INTO #POLICIES (PolicyID,PolicyTypeID,CustomerID) VALUES

    (100001,100001,100001),

    (100002,100002,100001),

    (100003,100003,100001),

    (100004,100001,100002),

    (100005,100002,100002)

    CREATE TABLE #POLICYTYPES (PolicyTypeID INT,PolTypeName VARCHAR(20),ProviderID...

  • RE: Parameter Sniffing<!-- 864 -->

    Here are several suggestions -

    --SELECT @From = COALESCE(@From, Min(QuotationDate)),

    -- @To = COALESCE(@To , Max(QuotationDate))

    --FROM dbo.Quotation;

    --DECLARE @F_Loc DateTime = @From,...

  • RE: LEFT JOIN without predicate , still works but what is that?<!-- 864 --><!-- 864 --><!-- 864 -->

    Here's something I wrote some time ago (inspired by something Jack Corbett wrote years ago) which explains why you have two joins followed by two ON clauses:

    The order of tables...

  • RE: Scalar UDF versus Inline UDF<!-- 864 -->

    ScottPletcher (8/21/2014)


    Tracing scalar UDFs adds enormous time to its execution. That is, just trying to compute the time vastly increases the time. Thus, scalar UDFs generally are performing...

  • RE: Arithmetic overflow error converting expression to data type datetime.<!-- 864 -->

    -------------------------------------------------------------------------

    -- Your first query has lots of scope for simplification:

    -------------------------------------------------------------------------

    SELECT 0 AS SIRA

    ,TBLCARI.IND

    ,(

    SELECT SUM(BORC - ALACAK)

    FROM F0102D0001TBLCARIHAREKETLERI AS CARHAR

    WHERE CARHAR.FIRMANO = TBLCARI.IND

    ) AS BAKIYE

    ,TCG.ISLEMIND

    ,TBLCARI.SOYADI

    ,TBLCARI.ADI

    ,TBLCARI.SOYADI + ' ' + TBLCARI.ADI AS...

  • RE: Bronze Age Development<!-- 864 -->

    Speaking of bronze-age development, this is one of the very few threads I can post to. Attempting to reply to other threads (which look kinda "flat") raises an error. In...

  • RE: Query Help<!-- 864 -->

    jrusso (8/20/2014)


    I figured out a way to do it. Thank you

    Does it look something like this?

    SELECT

    [AmountGiven] = ISNULL(SUM(a.AmountGiven), 0),

    a.YearToDate,

    a.EndDate

    FROM ( -- a

    SELECT

    [AmountGiven] = MAX(x.[AmountGiven]),

    [EndDate] = MAX(y.[EndDate]),

    YearToDate...

  • RE: Help with query !!!<!-- 864 -->

    You're welcome.

    Try this:

    DROP TABLE #TEMP

    CREATE TABLE #TEMP (PlayerName varchar(20),DismissFormat varchar(20),StrickRate int,CreatedDate date)

    INSERT INTO #TEMP VALUES ('ABC','Catch Out',100,'2014-01-12') --Date is in YYYY/MM/DD format

    INSERT INTO #TEMP VALUES ('ABC','Hit Wicket',50,'2014-01-13')

    INSERT INTO #TEMP VALUES...

  • RE: Display ALL rows even if no data exists

    Paul, if you wouldn't mind running through your sample script and correcting the errors which Steve kindly pointed out, I'll take a look later today.

  • RE: Are the posted questions getting worse?

    TomThomson (8/19/2014)


    ...that my wife hid (or, in wife-ese, "tidied up") ...

    Gaaah! Don't get me started. Every time I start work on a job in the extension, all my tools are...

  • RE: Display ALL rows even if no data exists

    J Livingston SQL (8/18/2014)


    pwalter83 (8/18/2014)


    sgmunson (8/18/2014)


    Okay, so now the excuse for not explaining EVERYTHING is that some of the columns aren't in use??? Really? Sorry, but...

  • RE: ROW_NUMBER in a WHILE loop

    It looks like you are trying to run through sys.tables or whatever and do something to each table encountered, although as Gail points out, it's bl00dy hard to tell from...

  • RE: Display ALL rows even if no data exists

    I know what you are attempting to do here and it wouldn't take long with access to your tables, however scripts for all of the tables along with sample data...

  • RE: Display ALL rows even if no data exists

    Hi Paul

    Can you provide the following please?

    CREATE TABLE for MG_COUNTRY with INSERTs to populate a few sample rows

    Do you wish to include every row from this table in the report?...

  • RE: Need help with query anyone ???

    SELECT

    [Id Number],

    [Family Name],

    [Given Name],

    Title,

    [Timesheet Date] = MAX([Timesheet Date]),

    [Start Date],

    [End Date]

    FROM YourVacationTable

    WHERE [Start Date] <= @EndDate

    AND [End Date] >= @StartDate

    GROUP BY [Id Number],[Family Name],[Given Name],Title,[Start Date],[End Date]

Viewing 15 posts - 3,016 through 3,030 (of 10,144 total)