Forum Replies Created

Viewing 15 posts - 5,056 through 5,070 (of 10,144 total)

  • RE: Looping without cursor not updating properly

    TheSQLGuru (3/12/2013)


    One minor point ChrisM - never do a SELECT INTO... with an ORDER BY. No benefit there.

    Thanks for the reminder, Kevin. I wouldn't say "never" however, I'd say...

  • RE: Looping without cursor not updating properly

    Siobhan Perricone (3/12/2013)


    ChrisM@Work (3/12/2013)


    Gosh :blush: thanks!

    A gentle reminder - always always test 🙂 If this solution works, it can be condensed and tweaked for performance.

    Yeah, I'm testing now. Looks...

  • RE: How to pass BIGINT data type values to IN CLAUSE in sql server 2008?

    This

    declare @Rid bigint

    set @Rid =106,108;

    generates an error, because bigint datatype holds a single bigint, not a list of them. If @Rid was a character type then you would be able...

  • RE: How to create a query which kill CPU?

    Set up a million-row (or more) test table (see Jeff Moden's articles) and do a triangular join running totals on it.

    Gather index frag stats. This one is from Glen Berry's...

  • RE: Looping without cursor not updating properly

    No worries mate. I had the day off yesterday and picked it up at home - when you hadn't posted up by this morning it was ready to go.

  • RE: Looping without cursor not updating properly

    Gosh :blush: thanks!

    A gentle reminder - always always test 🙂 If this solution works, it can be condensed and tweaked for performance.

  • RE: Looping without cursor not updating properly

    This solution I belive matches your description:

    IF OBJECT_ID('tempdb..#FirstChoice') IS NOT NULL DROP TABLE #FirstChoice;

    IF OBJECT_ID('tempdb..#SecondChoice') IS NOT NULL DROP TABLE #SecondChoice;

    IF OBJECT_ID('tempdb..#RemainingPitches') IS NOT NULL DROP TABLE #RemainingPitches;

    IF OBJECT_ID('tempdb..#RemainingPunters') IS...

  • RE: Looping without cursor not updating properly

    This proposed solution is slightly different.

    Start by allocating punters picked at random, to pitches, based on punter's first choice. Using the sample set, most towns have all pitches allocated,...

  • RE: Query runs too slow!

    This might give you a little boost too:

    SELECT a.id, a.GUID, a.SubmissionID, b.id, b.GUID, b.SubmissionID, 1

    FROM dbo.All_keys_ AS a

    INNER JOIN dbo.Load1_keys_ AS b

    on a.mkMatchKeyType1 = b.mkMatchKeyType1

    WHERE NOT EXISTS (SELECT 1 from...

  • RE: Looping without cursor not updating properly

    Here's a proposed solution. I've broken it up into stages using #temp tables which can be read for the purpose of verifying the results.

    IF OBJECT_ID('tempdb..#FirstChoice') IS NOT NULL DROP TABLE...

  • RE: Looping without cursor not updating properly

    Here's a working dataload:

    -- set identity insert on for lottery

    SET IDENTITY_INSERT survey.FirewoodLottery ON

    -- entering sample data into lottery table

    INSERT INTO [survey].[FirewoodLottery]

    (FirewoodLottery_id --DateValue, Value, YearValue, Monthvalue,

    ,[Firstname]

    ,[MiddleInitial]

    ,[Lastname]

    ,[Suffix]

    ,[address]

    ,[city]

    ,[state]

    ,[zip]

    ,[phone]

    ,

    ,[postdate]

    ,127.0.0.1

    ,[choice1]

    ,[choice2]

    ,[assigned]

    ,[status]

    ,[District]

    ,[sortindex]

    ,[choice]

    ,[Notes]

    --,[possible_dup]

    )

    select 1,'Wombat',NULL,'Champine',NULL,'15...

  • RE: Counter inside SELECT

    RZ52 (3/7/2013)


    ...What I need to know is how I can make a counter inside a SELECT with a manually created seed.

    Thanks again.

    That's exactly what Jason's code is designed to do....

  • RE: Performing strange conditional COUNT

    Nice one geezer 😎

    It makes for a surprisingly succinct query.

  • RE: Query to get rows if value contains result of another query

    winmansoft (3/7/2013)


    ChrisM@Work (3/7/2013)


    winmansoft (3/7/2013)


    ChrisM@Work (3/7/2013)


    yes - do this instead:

    DECLARE @Parameter VARCHAR(8000)

    SET @Parameter = 'seh,jyo,mhf'

    SELECT *

    INTO #Elements

    FROM dbo.DelimitedSplit8K (@Parameter,',')

    ...

  • RE: Query to find items purchased from multiple vendors

    SELECT d.Item

    FROM (

    SELECT

    a.Item,

    Vendor_Code

    FROM Purch_Inv_Line a

    INNER JOIN Purch_Inv_Header a

    ON a.[Document No_] = b.Item

    AND b.[Posting Date] BETWEEN '2010-01-01' AND '2010-12-31'

    GROUP BY a.Item, Vendor_Code

    ) d

    GROUP BY d.Item

    HAVING COUNT(*)...

Viewing 15 posts - 5,056 through 5,070 (of 10,144 total)