Forum Replies Created

Viewing 15 posts - 1,426 through 1,440 (of 3,957 total)

  • RE: Top Randomized Results with Multiple Qualifying Conditions

    I'd probably resort to a set-based loop.

    DECLARE @ROWS INT = 0;

    WHILE @ROWS = 0

    BEGIN

    WITH RandomWinners AS

    ...

  • RE: Need to fill the Gaps with previous value

    Leifton - For your case I might just use a correlated sub-query due to its simplicity and the fact that it has widespread understanding.

    Create Table #SensorHistory

    (

    [time]...

  • RE: Can you please anybody one explain?

    Sean Lange (9/24/2013)


    dwain.c (9/23/2013)


    Steven Willis (9/20/2013)


    techmarimuthu (9/19/2013)


    How to do database migration in Sql server?

    i need basic and step by step instruction.....

    Please help me

    Thanks in advance

    The easiest method is to use...

  • RE: subtract from two tables

    Cadavre (9/24/2013)


    The question now of course becomes, which is faster over a million rows? 😀

    Somehow I just knew you were going to say that. 🙂 +1

  • RE: Can you please anybody one explain?

    Steven Willis (9/20/2013)


    techmarimuthu (9/19/2013)


    How to do database migration in Sql server?

    i need basic and step by step instruction.....

    Please help me

    Thanks in advance

    The easiest method is to use Generate Scripts under...

  • RE: Creating a new column and inserting data on it from an existing column

    Something like this perhaps?

    WITH SampleData (MyString) AS

    (

    SELECT 'this,guy (Chicago)'

    )

    SELECT MyString

    ,C1=RTRIM(MAX(CASE WHEN ItemNumber = 1 THEN Item END))

    ...

  • RE: Are the posted questions getting worse?

    Jeff Moden (9/23/2013)


    dwain.c (9/23/2013)


    Grant Fritchey (9/23/2013)


    Careful there! NSA monitoring in progress.

    Thank goodness for that. Someone has to keep us ol' submarine sailors from having too much fun. ...

  • RE: Rolling 3 month average cost help

    As Sean suggested (1 and 2):

    DECLARE @Admission TABLE

    (

    [Contract] VARCHAR(4)

    ,Admissiondate VARCHAR(6)

    ,SumofCost MONEY

    );

    INSERT INTO @Admission

    SELECT '0606','200701',8639.38

    UNION ALL SELECT...

  • RE: Phone number question - detecting and replacing

    matt6749 (9/23/2013)


    I respect your wish to have structured forum dialog, but it appears that, for this relatively simple question, helpful suggestions are possible without INSERT INTO and CREATE TABLE samples.

    I'd...

  • RE: Where clause - Where "string" in any field in specified table

    Is there some reason you can't make Ys = 1 and Ns = 0, then just add them up to avoid the CHARINDEX?

  • RE: subtract from two tables

    Perhaps this works also?

    DECLARE @Store_Out_Details AS TABLE (PurchaseOrderNo CHAR(3), SerialNo CHAR(4), Qty INT);

    INSERT INTO @Store_Out_Details

    VALUES ('001','I000',20),('001','I001',10),('002','I000',50),('003','I002',20);

    DECLARE @Store_PO_Details AS TABLE (IssueNo CHAR(4), SerialNo CHAR(4), Qty INT);

    INSERT INTO @Store_PO_Details

    VALUES('S001','I000',10),('S002','I001',5);

    SELECT SerialNo, Qty=SUM(Qty)

    FROM

    (

    ...

  • RE: Aggregate minutes from varchar datatype.

    Another way:

    -- Result in seconds

    SELECT SUM(LEFT(STATUSTRACKING, 2) * 3600 +

    DATEDIFF(second, '1900-01-01', CAST(STUFF(STATUSTRACKING, 1, 2, '00') AS DATETIME)))

    FROM #sum_minutes

  • RE: Better way to write this query

    How about one of these 2 options? At least they don't do the CONVERTs twice.

    INSERT INTO ReportRecipients

    SELECT rs.[ReportID]

    ,rs.[ATID]

    ...

  • RE: Are the posted questions getting worse?

    Grant Fritchey (9/23/2013)


    Jeff Moden (9/23/2013)


    Grant Fritchey (9/23/2013)


    Rolled out an explosive. It could be a lady finger or a nuclear bomb. Curious how it's going to go off. Stand by for...

  • RE: How to get exact values for a constraint in SQL Server??

    yghaziza (9/23/2013)


    @Grasshopper, problem is that client (GUI) has no control over the constraints or values for data as this is read-only GUI. Data is controlled by other means and user...

Viewing 15 posts - 1,426 through 1,440 (of 3,957 total)