Forum Replies Created

Viewing 15 posts - 196 through 210 (of 267 total)

  • RE: compre data row by row

    That was a really nice technique Scott

    Unite And Conquer !

    /rockmoose

  • RE: Masking an amount

    You could do it in SQL:

    create table #t(amount money not null)

    insert #t select 25.23 union select  485.56

    select

     amount,

     replicate('0',11-len(convert(varchar,amount)))+replace(convert(varchar,amount),'.','')

    from

     #t

    drop table #t

    Important:

    The above will return NULL if amount > 99 999 999.9999

    ( You...

  • RE: compre data row by row

    Weirdly enough, the CHECKSUM and BINARY_CHECKSUM functions do not take table aliases ( or names ) !?

    For not having to type all the columnnames derived tables could be used.

    select a.*,...

  • RE: Inserts 10000 Only

    The Access issue is resolved here:

    Tools -> Options -> Advanced -> And here is an option indicating the maximum number of rows.

    (this is for Access 2000, and I don't have...

  • RE: How to create a table with dynamic table name

    Hi,

    You would have to make use of dynamic sql.

    Like so:

    DECLARE @tablename SYSNAME

    SET @tablename = 'MyTable'

    EXEC( 'CREATE TABLE ' + @tablename + ' (Id INT NOT NULL PRIMARY KEY, Col1 CHAR(10)...

  • RE: global constant

    Hi,

    Put the global constant(s) in a table.

    Then write a scalar function to access the global constant(s),

    Or just select from this table to retrieve the constant in the table.

    If you need...

  • RE: Inserts 10000 Only

    Check if the view is declared with a TOP 10000 clause.

    And by the way there is no limit for views to only return 10000 rows.

    /rockmoose

  • RE: Select latest 2 records - Select top?

    Yes,

    And actually the correlated subquery technique only requires the table to have a Primary Key ( Or Unique Constriant ) defined on 1 column.

    The requirement is that the Uniqueness is defined...

  • RE: Convert a Group By Row Result into Columns (holy grail...)

    Yup crosstabs is not a forte in SQL :-(, it could be easier to manage in code...

    What You could do is write a method (in VB/C#... ) that takes a...

  • RE: New Query with Previous Query Result...how?

    Another option is to use a Table Variable. This just creates a table in memory, a temporary table is "pysically" created in tempdb.

    I use both techniques.

    /rockmoose

  • RE: Convert a Group By Row Result into Columns (holy grail...)

    This is a classic Crosstab query.

    Search on this forum for "Crosstab" and you will come up with some tips, tricks and procs.

    eg.

    http://www.sqlservercentral.com/scripts/contributions/936.asp

    /rokmooose

  • RE: Select latest 2 records - Select top?

    Sukhoi, select top2 ..... group by name, date order by date desc

    will not work.

    To get the result for a specific name you could do it like you suggest, but not...

  • RE: Select latest 2 records - Select top?

    You also could enumerate the groups within a group, and retrieve the ordinals from these enumerated groups that you arre interested in.

    In this case You want the first two occurences...

  • RE: Merge two views into 1

    Suggest: ( have omitted the CREATE VIEW statement )

    1.

    SELECT

     twotab.mod_code,

     SUM(twotab.sum_smo_mcrd) AS sum_smr_mcrd,

     SUM(twotab.sum_smr_mcrd) AS sum_smr_mcrd

    FROM

     ( SELECT mod_code, 0 as sum_smo_mcrd, SUM(smr_mcrd) AS sum_smr_mcrd

     FROM dbo.ins_smr

     GROUP BY mod_code

     UNION ALL

     SELECT mod_code, SUM(smo_mcrd) AS sum_smo_mcrd, 0...

  • RE: Handling multiple transactions

    I have two suggestions:

    1. IF the UI guys are using .NET, they can make use of a dataset and perform all the changes in the dataset, then either commit or...

Viewing 15 posts - 196 through 210 (of 267 total)