Forum Replies Created

Viewing 15 posts - 1,831 through 1,845 (of 8,416 total)

  • RE: Turn negative numbers into 0

    mister.magoo (7/19/2011)


    The recursive part of the CTE returns no extra data, but coerces sql into storing the results (it will plop the results in tempdb once there are enough I...

  • RE: Turn negative numbers into 0

    The Dixie Flatline (7/18/2011)


    And also...

    select (ABS(@test)+@test)/2 as result

    Neat!

  • RE: Turn negative numbers into 0

    CELKO (7/18/2011)


    SIGN (1 + SIGN(x)) * x

    but it means using x twice. Hide it in a CTE and use the twice.

    CTEs generally don't help - the expression is evaluated...

  • RE: Turn negative numbers into 0

    You can avoid performing the complex calculation more than once:

    DECLARE

    @A INTEGER = NULL,

    @b-2 INTEGER = -351,

    @C INTEGER = 45,

    @d INTEGER = 999;

    SELECT

    Calculation.result * ((SIGN(Calculation.result) + 1) / 2)

    FROM

    (

    SELECT...

  • RE: Revisited: RAID10 vs RAID1 SQL

    invulnarable27 (7/18/2011)


    I would like a further explanation of why I should keep the tempdb on the RAID10 array along with the data file. Why not the RAID1 array with...

  • RE: Filtered OUTPUT Clause

    opc.three (7/17/2011)


    I was referring to restrictions in terms of using OUTPUT results in a derived table.

    Right, I'm with you now - yes 'composable DML' is limited to being a source...

  • RE: Filtered OUTPUT Clause

    opc.three (7/17/2011)


    Can you? This would seem like Option (i.e. workaround) #3. The filtering is not technically part of the OUTPUT clause but it will work.

    The OUTPUT rows are produced by...

  • RE: Revisited: RAID10 vs RAID1 SQL

    invulnarable27 (7/17/2011)


    Or would you put the tempdb on the RAID10 array along w/ the data file?

    This one.

  • RE: Convert string to datetime

    sql_novice_2007 (7/14/2011)


    How can I convert the following string to date time data.

    July 7 2011 12:47 pm EDT

    The conversion is the easy part. Don't forget to think about how your...

  • RE: order by some records only

    This is another way of writing a query to suit the requirement:

    CREATE TABLE #Cities

    (

    city_name VARCHAR (25) NULL

    );

    CREATE INDEX nc1 ON #Cities (city_name);

    INSERT #Cities

    (city_name)

    VALUES

    ('Chennai'),

    ('Hyderabad'),

    ('Bangalore'),

    ('Bombay'),

    ('Kolkata'),

    ('Cochin'),

    ('Ahemadabad'),

    ('Bangalore'),

    (NULL),

    ('Delhi');

    SELECT

    ranked.city_name

    FROM

    (

    SELECT

    city_rank = CONVERT(BIGINT, -1),

    c.city_name

    FROM #Cities AS c

    WHERE

    c.city_name IS...

  • RE: duplicated records

    sqlfriends (7/16/2011)


    My question is : is it an common case that when join multiple tables we get duplicated recors, and it is Ok then use update to perform on those...

  • RE: database growth

    There are hundreds of scripts out there for things like this. I used Google to find this:

    http://sqlserverteam.blogspot.com/2008/11/monitor-database-growth.html

    There are probably better ones. Have a look around.

  • RE: Create View- T-SQL Syntax error

    I normally write such stubs the other way around, to avoid all that tedious messing about with quotes in the view definition:

    IFOBJECT_ID(N'dbo.MyView', N'V')

    IS NULL

    EXECUTE ('CREATE VIEW dbo.MyView AS SELECT 1...

  • RE: Filtered OUTPUT Clause

    Yes, you can filter an OUTPUT clause, and achieve what you want to do in one statement:

    DECLARE @Production TABLE (col1 INT NULL, col2 INT NULL, col3 INT NULL);

    DECLARE @Archive TABLE...

  • RE: TDE and Filegroups

    First again!

    Good question - I guessed correctly, but still leaned a new fact for the day. Cool.

Viewing 15 posts - 1,831 through 1,845 (of 8,416 total)