Forum Replies Created

Viewing 15 posts - 1,216 through 1,230 (of 2,894 total)

  • RE: How to add code in this store procedure to void empty data?

    adonetok (9/13/2012)


    I use one store procedure to select data as below code:

    select * from ORDER where city='London'

    In asp.net app, one dataset will be created based on this store procedure.

    How to...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Date Function

    You don't need to use UDF, there is in-build format for T-SQL CONVERT function:

    select convert(varchar, GETDATE(), 107)

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Order by with case

    Man, you do really need to read the previous posts.

    It's only going to work if you use dynamic sql.

    Please note, if you run the following type of query...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: ALTER COLUMN fails when changing datatype of PRIMARY KEY

    ...

    Do you realistically expect to write to this table more times that the number of atoms in the Universe?

    ...

    Sorry, I completely forgot this one. Could you please remind me...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Effect of adding update statistics as part of the stored procedure

    It takes some time to update statistics....

    What are you doing exactly in your stored proc?

    It can be well justified if it does modify big chunk of a table.

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Puzzle : Generating two unique numbers from an array of numbers (repetation not allowed)

    dwain.c (9/12/2012)


    Here's a version of the Tuples solution that runs in about 1/3 the time:

    ...

    I like this one, as it's very different approach, but yeah it's still much slower.

    I...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: UniqueIdentifier as a Primary Key

    alanspeckman (9/12/2012)


    Is it ever considered a best practice to use a UniqueIdentifier(GUID) as a primary key?

    ...

    Nowadays, it's not considered as the best practice. However, there are cases where the use...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Puzzle : Generating two unique numbers from an array of numbers (repetation not allowed)

    ChrisM@Work (9/12/2012)


    A completely different method, courtesy of Dwain C:

    ;WITH SourceNums AS (

    SELECT strcol FROM (VALUES ('1'),('2'),('5'),('7'),('8'),('9')) a (strcol)

    ),

    nTuples (n, Tuples) AS (

    SELECT 1, CAST(strcol...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Puzzle : Generating two unique numbers from an array of numbers (repetation not allowed)

    ...

    The only way to make it more efficient is to shortcut the math. That's why some are hard-coding 3 as the final digit. (It only saves one step...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: SQL Query Help - Join + Max

    Have a look my example. The problem is here:

    LEFT JOIN dbo.TBL_VALUATIONS v ON a.pr_id = v.pr_id

    WHERE v.date_asset IN

    (SELECT MAX(a.date_asset)

    FROM TBL_VALUATIONS a LEFT JOIN TBL_PROPERTY b

    ON a.pr_id = b.pr_id

    GROUP BY a.pr_id)

    You...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: T-SQL Help Needed

    Greg Snidow (9/12/2012)


    Jeff Moden (9/12/2012)


    Greg Snidow (9/11/2012)


    The 'id' column in every table was a bit annoying to work with.

    It's even more annoying when you need it and it's not there....

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Puzzle : Generating two unique numbers from an array of numbers (repetation not allowed)

    Luis Cazares (9/12/2012)


    Try performance by time (miliseconds or nanoseconds)

    ...

    And the winner is the one you didn't include in your test:

    DECLARE @ddatetime2

    SET @d = SYSDATETIME()

    ;with a (num)

    as

    ( select * from (values...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Puzzle : Generating two unique numbers from an array of numbers (repetation not allowed)

    I've tried all three methods, INNER JOINs, CROSS APPLY and CROSS JOIN with WHERE: all produce very similar query plans with use of Nested Loops (Inner Join).

    Cannot see much...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Puzzle : Generating two unique numbers from an array of numbers (repetation not allowed)

    Luis Cazares (9/12/2012)


    Eugene Elutin (9/12/2012)


    You don't really need last join as the last digit of the second number can only be '3'

    Wouldn't that be cheating?

    ....

    Cheating? No, it's a common...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: SQL Query Help - Join + Max

    Your query for MAX(Date) should be linked somehow to entities you are querying above.

    I'm not 100%, may be that way:

    ELECT

    a.id,

    a.new_id,

    a.add_id,

    b.add_1,

    b.add_2,

    b.add_3,

    c.town,

    d.county,

    e.val,

    e.date

    FROM TBL a

    LEFT JOIN TBL_ADD b ON a.addir = b.addid

    LEFT JOIN...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

Viewing 15 posts - 1,216 through 1,230 (of 2,894 total)