Forum Replies Created

Viewing 15 posts - 1,951 through 1,965 (of 2,894 total)

  • RE: Cursor row-by-row updates

    You don't need NTILE...

    -- create sample table

    select top 1000 4441 as groupnumber , cast(null as bit) statusbit

    into #t

    from syscolumns

    -- update

    ;with cte

    as

    (

    select *,(ROW_NUMBER() OVER (ORDER BY groupnumber)-1) % 5 ...

    _____________________________________________
    "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: Function to find whether last days of the month is weekend

    siva 20997 (3/12/2012)


    I do agree with most of your points. But still fail to see couple of things from my understanding of how computers function.

    Wheather the code is inLine or...

    _____________________________________________
    "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: Function to find whether last days of the month is weekend

    siva 20997 (3/12/2012)


    Eugene

    Would like to know if there is lot of differnce in the perfomance bitween

    User Defined Functions (like what I have posted)

    and system defined functions like DateAdd and...

    _____________________________________________
    "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: what is uniqueidentifier in sql how it will work

    ard5karthick (3/12/2012)


    Hi,

    Generally Uniqueidentifier is a 36 bit alphanumeric unique Value that will not be duplicated.

    Its syntax is XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.

    It is a data type in SQLServer & it will be mostly used...

    _____________________________________________
    "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: Function to find whether last days of the month is weekend

    oops, didn't see the thread end...

    But still, want to mention that it's not a good idea to use scalar-values user defined SQL function for doing it.

    In-line-sql, may look a...

    _____________________________________________
    "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: Using dynamic values

    opc.three (3/9/2012)

    Re: "you should try to make trigger as lightweight as possible"

    I could not agree more, Eugene. Unfortunately your example will force a full scan of the inserted 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: INSERT INTO MULTIPLE TABLES AT ONCE

    ColdCoffee (3/8/2012)


    You can not insert data into 2 tables simultaneously in a single session.

    But if u split the insert statements into 2 statements, it is going to give 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: Using dynamic values

    opc.three (3/8/2012)


    ...

    Now the example trigger:

    IF EXISTS ( SELECT *

    FROM sys.objects

    ...

    _____________________________________________
    "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: what is uniqueidentifier in sql how it will work

    Is it an interview question?

    _____________________________________________
    "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: Function to find whether last days of the month is weekend

    Gianluca Sartori (3/8/2012)


    I would not rely on DATENAME.

    Try prefixing that code with SET LANGUAGE Italian:

    L'impostazione della lingua รจ stata sostituita con Italiano.

    -----------------------

    2011-12-31 00:00:00.000

    (1 row(s) affected)

    I wouldn't too, if my database...

    _____________________________________________
    "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: Using dynamic values

    Beginner_2008 (3/8/2012)


    I am not going to use the cursor.

    ๐Ÿ˜›

    Then, you may miss some updates!

    There was a story remembered by some one here, about the company went bust because of...

    _____________________________________________
    "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: Table updates

    in short:

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    _____________________________________________
    "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: Function to find whether last days of the month is weekend

    declare @dt datetime

    set @dt = '20120101'

    SELECT DATEADD(DAY,

    CASE DATENAME(WEEKDAY,DATEADD(DAY,-1,DATEADD(MONTH, DATEDIFF(MONTH,0,@dt),0)))

    ...

    _____________________________________________
    "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: Using dynamic values

    Looks like OP is not going to listen...

    Ok, you can take this and kill yourself :hehe::

    CREATE TRIGGER CustomerUpdateMail

    ON customer_info

    FOR UPDATE

    AS

    SET NOCOUNT ON;

    declare @message nvarchar(2000);

    DECLARE crsUpd CURSOR FAST_WORWARD

    FOR...

    _____________________________________________
    "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: How to write a query to pick up only duplicated records like this?

    Your code is fine to me, but you can use CTE to make it "look nice":

    ;with duplicates

    as

    (

    select [name] from infosys

    group by...

    _____________________________________________
    "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,951 through 1,965 (of 2,894 total)