Forum Replies Created

Viewing 15 posts - 796 through 810 (of 2,006 total)

  • RE: Simplify the query?

    For those that want the code but don't want to download a .doc, here is the original query.

    DECLARE @keydoc INT

    SET @keydoc = 539428

    SELECT DISTINCT a.keydoc, a.keyfreesiteaccess, a.keyfreesiteaccesspublishable

    FROM objectviews..aisarticle a

    LEFT JOIN...

  • RE: Need a T-SQL Script to create millions of rows

    beginnew2012 (3/14/2012)


    I'm sorry but I don't see any create table statements?

    I want my table to be stored in a separate database, let's call it myDB.

    This code is very complex to...

  • RE: Contacenating Rows Into 1 Column

    dec_obrien (3/14/2012)


    Hi,

    Yes it works (although I've no idea why!).

    THanks

    I'll try an example that you can follow in your SQL window

    First, set your results to text and...

  • RE: Need a T-SQL Script to create millions of rows

    beginnew2012 (3/14/2012)


    Cadavre, I don't want the table to be a temporary table. I want an actual table, what changes should I apply?

    Change all references to #testEnvironment into whatever table name...

  • RE: Need a T-SQL Script to create millions of rows

    Lowell (3/14/2012)


    Cadavre (3/14/2012)


    This will create 1,000,000 rows of pseudo-random unique firstName, secondName, e-mail address and mail address.

    I like your example Cadavre, but there's a possbility of creating names that contain...

  • RE: Contacenating Rows Into 1 Column

    dec_obrien (3/14/2012)


    Is there a way to not add the extra commas if there isn't a corresponding seq

    Yes. Do what ColdCoffee said in the first place.

    Untested, but it should be something...

  • RE: Need a T-SQL Script to create millions of rows

    This will create 1,000,000 rows of pseudo-random unique firstName, secondName, e-mail address and mail address.

    SET NOCOUNT ON;

    IF object_id('tempdb..#testNames') IS NOT NULL

    BEGIN

    DROP TABLE #testNames;

    END;

    WITH t1(N) AS (SELECT...

  • RE: Get month names ordered using recursion

    If you insist on not using a calendar table, then this is better: -

    WITH t1(N) AS (SELECT 1 UNION ALL SELECT 1),

    t2(N) AS (SELECT 1 FROM t1 x, t1 y),

    CTEMonth(MonNum)...

  • RE: Sorting comma separated numbers

    IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DelimitedSplit8K]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))

    BEGIN

    DROP FUNCTION [dbo].[DelimitedSplit8K];

    END

    GO

    CREATE FUNCTION [dbo].[DelimitedSplit8K]

    --===== Define I/O parameters

    ...

  • RE: sql query for below scenario

    Bit of a late reply.

    --Your current code

    SELECT *

    FROM EBBReport

    WHERE IsCurrent = 0

    AND (Datediff(dd, @EFFdate, convert(VARCHAR, getdate(), 1)) <= 90 AND

    Datediff(dd, @EFFdate, convert(VARCHAR, getdate(), 1))...

  • RE: sql query for below scenario

    nilesh k (3/9/2012)


    This is what i tried:

    Option 1:

    SELECT base.*

    FROM table base

    INNER JOIN (SELECT segment, MAX([PostedDate]) AS Max (PostedDate)

    FROM...

  • RE: Evils of coalesce on a column in the Where clause due to nullable parameters

    Gail Shaw wrote about "Catch all" queries a while ago[/url].

    Since then, whenever I've needed to do something like that I've always started with that article in my mind.

  • RE: Select columns dynamically

    Eugene Elutin (3/7/2012)


    Cadavre (3/7/2012)


    ... The original question was reasonably interesting and the dynamic SQL for any table was an entertaining intellectual challenge.

    Have you heard about solving SUDOKU in T-SQL?...

  • RE: Select columns dynamically

    Eugene Elutin (3/7/2012)


    Gentlemen, looks like you have a lot of free time...

    Can some one come up with the reasonable idea for doing it in the first place?

    I do not beleive...

  • RE: Update with cursors

    SKYBVI (3/7/2012)


    I dont think DDL is needed and sample data i already put..

    Leave the question if u can't help.

    Everyone that has posted in this thread could help. But you seem...

Viewing 15 posts - 796 through 810 (of 2,006 total)