Forum Replies Created

Viewing 15 posts - 6,796 through 6,810 (of 10,143 total)

  • RE: is this something wrong with this query

    Try these two variants of your WHERE clause:

    WHERE ([State] <> N'Closed'

    AND Title LIKE N'%Bahamas%')

    OR History LIKE N'%TheGreatCharlie%'

    OR [Repro Steps] LIKE N'%Anything%'

    WHERE [State] <> N'Closed' ...

  • RE: is this something wrong with this query

    Vishal Singh (8/4/2011)


    Hi Pals,

    Not sure wwhatswrong with this query but whenever I am running this, I am getting all those rows with State='closed' which it should ignoring.

    SELECT [ID],Priority,Title,[Created By],[Assigned To],...

  • RE: LEFT JOIN WITH COUNT Question

    SELECT A.MSFTID,

    SUM(COUNT(*)) OVER(PARTITION BY A.MSFTID) AS 'COUNT',

    b.ULTIMATE_SUPER,

    b.servicepackname,

    A.name

    FROM vwMY_VULNS A

    LEFT JOIN MSSUPERMAP B

    ON A.MSFTID = B.bulletinnumber

    WHERE a.MSFTID LIKE '%MS%'

    GROUP BY A.MSFTID, b.ULTIMATE_SUPER, b.servicepackname, A.name

    ORDER BY...

  • RE: MERGE statement to include new column that is an identity column. Don't know how to populate.

    hxkresl (8/3/2011)


    ...How do i finish the merge statement so that it contains auto incremented number values in the 'schemamapping' column?..

    Since 'schemamapping' is set to autoincrement, it shouldn't appear in the...

  • RE: SQL code issue

    pwalter83 (8/3/2011)


    ... display data where the ARRIVAL_SCHEDULE_DT is three months preceding current date when the ship first arrived at PORT_CD = 'BEZEE' (I work for a shipping company). I know...

  • RE: How will you write a query for this scenario

    GSquared (8/3/2011)


    ChrisM@Work (8/3/2011)


    Recursive CTE's don't allow aggregate functions but they do allow ROW_NUMBER() which provides you with a means of obtaining MIN() and MAX():

    http://www.sqlservercentral.com/Forums/FindPost1137945.aspx

    It's probably going to be slower than...

  • RE: How will you write a query for this scenario

    Recursive CTE's don't allow aggregate functions but they do allow ROW_NUMBER() which provides you with a means of obtaining MIN() and MAX():

    http://www.sqlservercentral.com/Forums/FindPost1137945.aspx

  • RE: Compare dates

    -- make a sample table with some dates in it

    DROP TABLE #Dates

    CREATE TABLE #Dates (RandomDate DATETIME)

    INSERT INTO #Dates (RandomDate)

    SELECT Dateval = GETDATE() + n.RN

    FROM (SELECT TOP 100 RN =...

  • RE: Problem Query

    In full agreement with everybody who's posted so far - this is a lot of work, and you have a lot to learn. Here's a start - you need to...

  • RE: Logic

    Nice work John, cheers 🙂

  • RE: Logic

    -- make some sample data

    DROP TABLE #Test

    CREATE TABLE #Test (MyString VARCHAR(30))

    INSERT INTO #Test (MyString) SELECT 'IncomeTax'

    INSERT INTO #Test (MyString) SELECT 'InheritanceTax'

    INSERT INTO #Test (MyString) SELECT 'PurchaseTax'

    INSERT INTO...

  • RE: Conversion failed when converting from a character string to uniqueidentifier.

    Can you post the whole query? It should work:

    drop table #test

    create table #test (id int identity(1,1), guidcol uniqueidentifier)

    insert into #test (guidcol) select NEWID()

    insert into #test (guidcol) select NEWID()

    insert into #test...

  • RE: Comparinng integer like string values.

    Joy Smith San (7/29/2011)


    ...

    Problem is we can't create function or any other objects in client's DB. Have to manage with select query itself...

    No problem.

    SELECT d.MyKey, d.AppVersion, x1.*

    FROM (

    SELECT MyKey =...

  • RE: Comparinng integer like string values.

    This shows some promise:

    SELECT d.MyKey, d.AppVersion, x1.OrderSeq

    FROM (

    SELECT MyKey = 1, AppVersion = '10.1.55.3366'

    UNION

    SELECT 1, '10.1.99.64'

    UNION

    SELECT 1, '10.1.1.1'

    UNION

    SELECT 1, '10.1.3.9'

    UNION

    SELECT 3, '9999.9999.9999.9999'

    UNION

    SELECT 2, '7.0.4'

    UNION

    SELECT 2, '7.1'

    UNION

    SELECT 2, '8'

    UNION

    SELECT...

  • RE: Been wracking my brains with this

    SELECT TimesheetKey, SiteKey, [Date],

    SUMDuration = SUM(Duration) OVER(PARTITION BY SiteKey, [Date], GroupRule), GroupRule

    FROM #TIMESHEET

Viewing 15 posts - 6,796 through 6,810 (of 10,143 total)