Forum Replies Created

Viewing 15 posts - 751 through 765 (of 1,131 total)

  • RE: String Question

    This is a lot easier without the procedure code such as the while loop and no variables are needed.

    create table stats_2

    (Counterinteger not null primary key

    , childcampvarchar(255) not null

    , deptvarchar(255)

    )

    insert into...

    SQL = Scarcely Qualifies as a Language

  • RE: Banker''''s rounding in T-SQL (like Math.Round in .NET)

    Sorry, Jeff, but the use of STR does not work as the expected results are incorrect. With Banker's Rounding to 2 decimal points:

    For 3.455, since the third decimal position...

    SQL = Scarcely Qualifies as a Language

  • RE: will adding primary key affect performance negatively?

    "The argument from the original developers is that adding the primary key will negatively affect performance."

    Acually, declaring primary keys, foreign key constraints and insuring that all columns are not null...

    SQL = Scarcely Qualifies as a Language

  • RE: should I use "barcodes" as a primary key?

    "I'll use the barCode, that HAS to be unique."

    Actually, no it does not need to be unique. I ran into this problem a few years ago in the health...

    SQL = Scarcely Qualifies as a Language

  • RE: Banker''''s rounding in T-SQL (like Math.Round in .NET)

    Jeff and Ryan, try your solutions with these four test cases.

    The differences between the pairs is in the second decimal position number being odd or even.

    The difference between...

    SQL = Scarcely Qualifies as a Language

  • RE: Banker''''s rounding in T-SQL (like Math.Round in .NET)

    So the banker's rounding algorithm must be applied from right to left? Try this:

    create FUNCTION RoundBanker

    ( @Amtnumeric(38,16)

    , @RoundToDecimal tinyint

    )

    RETURNS numeric(38,16)

    AS

    BEGIN

    declare@RoundedAmtnumeric(38,16)

    ,@WholeAmtinteger

    ,@Decimaltinyint

    ,@Tennumeric(38,16)

    set@Ten= 10.0

    set@WholeAmt= ROUND(@Amt,0, 1 )

    set@RoundedAmt= @Amt - @WholeAmt

    set@Decimal= 16

    While...

    SQL = Scarcely Qualifies as a Language

  • RE: Banker''''s rounding in T-SQL (like Math.Round in .NET)

    This SQL uses the banker's rounding algorithm:

    DECLARE@Decimalssmallint

    set@Decimals= 2

    select BRAmt

    ,BRExpectedAmt

    , CASE

    WHEN 5 = ( ROUND(BRAmt * POWER( 10, @Decimals + 1 ) ,0,1) - (ROUND(BRAmt * POWER( 10,...

    SQL = Scarcely Qualifies as a Language

  • RE: replacing a subquery with a join

    DTS Global Variables as parameters do not work very well with SQL statements due too many limitations such as you have indicated. But Global Variables work fine with stored...

    SQL = Scarcely Qualifies as a Language

  • RE: Dropped sp_spaceused

    Somehow, the SQL Server configuration has been modified to allow system administrators to drop or change system components.

    To view the configuration, run stored procedure sp_configure and look at the value...

    SQL = Scarcely Qualifies as a Language

  • RE: How To Write A Single Record From Non-Contiguous Dates

    This is a variation on the problem of finding contigous theater seats. Search for CELKO and "theater seats" for some other solutions.

    The solution is rather long. First you...

    SQL = Scarcely Qualifies as a Language

  • RE: Copying files using T-SQL

    This can only be done by using xp_cmdshell. For privileges, this stored procedure can only be executed by someone with system administration rights.

    P.S.

    I recently read Joe Celko's SQL book and...

    SQL = Scarcely Qualifies as a Language

  • RE: Removing BUILTIN/Administrator Login

    When you DENY access to BUILTIN/Administrator, this overrides any grants to any member of the local administrators group and therefore you cannot login.

    You are not the first person with this situation. ...

    SQL = Scarcely Qualifies as a Language

  • RE: Triggers and the effect

    "I assume that the results of the update, delete, insert statement would cause corruption or partially changed data."  It could if the cause of the crash were a disk drive...

    SQL = Scarcely Qualifies as a Language

  • RE: Trigger on a system table

    Triggers are not allowed on SQL Server 2000 system tables and any attempt to create a trigger will cause the the following error message:

    Server: Msg 229, Level 14, State 5, Procedure sysobjects_tia, Line...

    SQL = Scarcely Qualifies as a Language

  • RE: Is there a better way to ignore time portion of a smalldatetime field

    "However, would you ever use such a construct in the WHERE clause of a query?"

    I would hope not, as this would preclude the use of an index.

    For the WHERE, bettter...

    SQL = Scarcely Qualifies as a Language

Viewing 15 posts - 751 through 765 (of 1,131 total)