Forum Replies Created

Viewing 15 posts - 9,361 through 9,375 (of 10,144 total)

  • RE: Functio to get Amount in words.

    Here's another way, similar. Quite quick.

    [font="Courier New"]ALTER FUNCTION dbo.ToWords(@TheNumber DECIMAL (15,2), @CurrencyName VARCHAR(20), @JoinWord VARCHAR(20), @CentsName VARCHAR(20))

    RETURNS VARCHAR(200)

    -- USAGE: SELECT dbo.ToWords(1.01, 'dollar(s)', 'and', 'cent(s)')

    -- MAX. VALUE: 999999999999.99 (twelve nines...

  • RE: removing duplicates

    Try using UNION on its own rather than UNION ALL, which ensures that duplicates are retained in the output.

  • RE: Insert and update in one stored proc (inserting record twice)

    Patrick Ige (11/25/2008)


    Chris why do you reckon this

    select COUNT(*)

    from companies where

    code=@code and openedy=@openedyr and openedmonth=@openedmont

    would return 2 rows?

    If i send the paramters 01,2007,12 i do get a single...

  • RE: Insert and update in one stored proc (inserting record twice)

    Patrick

    What do you expect the following statement to do:

    select

    @company

    from companies where

    code=@code and openedy=@openedyr and openedmonth=@openedmont

    Without testing it, I reckon it will return one column with the pre-assigned value of...

  • RE: Bypassing the keyword DISTINCT

    eddy (11/21/2008)


    Have another little question considering these same 2 tables also.

    I one would say,

    for each BASISREL ROW where BASISREL.ART_ID = 5 (example)

    ...

  • RE: Bypassing the keyword DISTINCT

    How many rows in DEELREL and BASISREL?

  • RE: To change the identity count

    Identity columns uniquely identify individual rows in a table and exist for the benefit of the database, not the business. It doesn't matter to the database if there are gaps...

  • RE: Bypassing the keyword DISTINCT

    How many rows are returned by this...

    [font="Courier New"]SELECT DISTINCT

                          b.BRL_ID, b.OFF_ID, b.MRL_ID, b.PAR_ID_FIRMA, b.PAR_ID_TYPE, b.PAR_ID_DISC, b.BRL_REGDATUM, b.BRL_BEGDATUM, b.BRL_ENDDATUM,

                          b.BRL_REMOVED, b.BRL_REMOVED_LISA, b.BRL_BASISNR, b.ADR_ID_KLANT, b.ARG_ID, b.ART_ID, b.ADR_ID_LAADNR, b.ADR_ID_LOSNR,

                          b.PAR_ID_EENHEID, b.PAR_ID_MUNT, b.PLS_ID_LADEN, b.PLS_ID_LOSSEN,...

  • RE: Find Closest Match Data

    Hi

    It works like this. For two equal strings, say @mcode= '0011246';

    Split c.TheValues into chunks (tokens), and test each one to see if it appears anywhere in @mcode. The tokens in...

  • RE: reverse the table

    Hello

    Here's an excellent article which describes various solutions to your problem.

    http://www.sqlservercentral.com/articles/T-SQL/63681/

    Cheers

    ChrisM

  • RE: Help with Money and Decimal datatype

    karthikeyan (11/20/2008)


    Jeff,

    Sorry ! a little late here..

    Heh... "Inputs are welcome!"

    🙂

    Actually this query is scheduled as night job...what it will do ...it will run on every night...

  • RE: conditional if statements

    yisaaacs (11/20/2008)


    yip. got it to compile.

    but i found a better way, as my previous post.

    thanks guys

    [font="Courier New"]SET @user-id =                        (SELECT [UserID] FROM [AppUsers] WHERE [Username] = @OldUsername)

    SET @OldMerchant =                (SELECT Merchant FROM...

  • RE: conditional if statements

    yisaaacs (11/19/2008)


    hi Seth, you code does not compile.

    Msg 137, Level 15, State 2, Line 28

    Must declare the scalar variable "@NewUserName".

    Msg 137, Level 15, State 2, Line 41

    Must declare the scalar...

  • RE: Using MAX in a SELECT Statement

    Hi Michael

    SELECT TOP (@RowCount) won't run (or let you create a function/sp etc) as it stands because TOP n is part of the statement. You would have to set this...

  • RE: Getting oldest/newest record by date

    Like this, you mean?

    [font="Courier New"]SELECT TOP 1 vom100.vst_int_id

                ,vom107.chi_evt_dtm

                ,vom107.order_code_ext_id

                ,vom200.order_code_desc1

    FROM      VOM107_CHILD_ORDER vom107 (nolock)

                ,VOM100_ORDER_HEADER vom100 (nolock)

                ,VOM200_ORDER_CODE vom200 (nolock)

    WHERE    vom107.ord_int_id = vom100.ord_int_id

                AND vom107.order_code_int_id = vom200.order_code_int_id

                --sample internal id

                AND vom100.vst_int_id = 936738

                --3=Lab, 4=microbiology, 18=lab dept use, 19=histology/path

                --40=lab pathology...

Viewing 15 posts - 9,361 through 9,375 (of 10,144 total)